4 * Deferrable Update for closure/callback
6 class MWCallableUpdate
implements DeferrableUpdate
{
7 /** @var Closure|callable */
11 * @param callable $callback
12 * @throws InvalidArgumentException
14 public function __construct( $callback ) {
15 if ( !is_callable( $callback ) ) {
16 throw new InvalidArgumentException( 'Not a valid callback/closure!' );
18 $this->callback
= $callback;
21 public function doUpdate() {
22 call_user_func( $this->callback
);