Update formatting on includes/deferred/
[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/callabck
9 */
10 private $callback;
11
12 /**
13 * @param callable $callback
14 */
15 public function __construct( $callback ) {
16 if ( !is_callable( $callback ) ) {
17 throw new MWException( 'Not a valid callback/closure!' );
18 }
19 $this->callback = $callback;
20 }
21
22 /**
23 * Run the update
24 */
25 public function doUpdate() {
26 call_user_func( $this->callback );
27 }
28 }