Move up devunt's name to Developers
[lhc/web/wiklou.git] / includes / deferred / CallableUpdate.php
1 <?php
2
3 /**
4 * Deferrable Update for closure/callback
5 */
6 class MWCallableUpdate implements DeferrableUpdate {
7 /**
8 * @var Closure|callable
9 */
10 private $callback;
11
12 /**
13 * @param callable $callback
14 * @throws MWException
15 */
16 public function __construct( $callback ) {
17 if ( !is_callable( $callback ) ) {
18 throw new MWException( 'Not a valid callback/closure!' );
19 }
20 $this->callback = $callback;
21 }
22
23 /**
24 * Run the update
25 */
26 public function doUpdate() {
27 call_user_func( $this->callback );
28 }
29 }