blob: 6eb554139377d916b61b6146499248b4c53072e6 (
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
25
26
27
28
29
30
|
<?php
/**
* Deferrable Update for closure/callback
*/
class MWCallableUpdate implements DeferrableUpdate {
/**
* @var closure/callabck
*/
private $callback;
/**
* @param callable $callback
*/
public function __construct( $callback ) {
if ( !is_callable( $callback ) ) {
throw new MWException( 'Not a valid callback/closure!' );
}
$this->callback = $callback;
}
/**
* Run the update
*/
public function doUpdate() {
call_user_func( $this->callback );
}
}
|