PHPSessionHandler: Implement SessionHandlerInterface
[mediawiki.git] / includes / deferred / CallableUpdate.php
blob4b19c200663c6c71ea69503b023778d62c7ce088
1 <?php
3 /**
4 * Deferrable Update for closure/callback
5 */
6 class MWCallableUpdate implements DeferrableUpdate {
7 /** @var Closure|callable */
8 private $callback;
10 /**
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 );