summaryrefslogtreecommitdiffstats
path: root/lib/private/command/closurejob.php
blob: abba120b7452d3d8303179751e497c01c6bcb926 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
/**
 * Copyright (c) 2015 Robin Appelman <icewind@owncloud.com>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */

namespace OC\Command;

use OC\BackgroundJob\QueuedJob;
use SuperClosure\Serializer;

class ClosureJob extends QueuedJob {
	protected function run($serializedCallable) {
		$serializer = new Serializer();
		$callable = $serializer->unserialize($serializedCallable);
		if (is_callable($callable)) {
			$callable();
		} else {
			throw new \InvalidArgumentException('Invalid serialized callable');
		}
	}
}