wiki.techinc.nl/includes/deferred/CallableUpdate.php
umherirrender b9cd789fce docs: closure -> Closure; callback -> callable
Changed closure to capital word Closure in doc and type hint,
also changed callback in docs to callable

Change-Id: I52c8e8f13d38a837052101c38b9986be780ca057
2014-04-19 08:43:31 +02:00

29 lines
513 B
PHP

<?php
/**
* Deferrable Update for closure/callback
*/
class MWCallableUpdate implements DeferrableUpdate {
/**
* @var Closure|callable
*/
private $callback;
/**
* @param callable $callback
* @throws MWException
*/
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 );
}
}