Merge "Fix positioning of jQuery.tipsy tooltip arrows"
[mediawiki.git] / includes / deferred / CallableUpdate.php
blob808626d0f9b5c7557e0395c9a31ae25665a79dd4
1 <?php
3 /**
4 * Deferrable Update for closure/callback
5 */
6 class MWCallableUpdate implements DeferrableUpdate {
7 /**
8 * @var Closure|callable
9 */
10 private $callback;
12 /**
13 * @param callable $callback
14 * @throws MWException
16 public function __construct( $callback ) {
17 if ( !is_callable( $callback ) ) {
18 throw new MWException( 'Not a valid callback/closure!' );
20 $this->callback = $callback;
23 /**
24 * Run the update
26 public function doUpdate() {
27 call_user_func( $this->callback );