MediaWiki  1.23.2
ScopedCallback.php
Go to the documentation of this file.
1 <?php
30  protected $callback;
31 
36  public function __construct( $callback ) {
37  if ( !is_callable( $callback ) ) {
38  throw new InvalidArgumentException( "Provided callback is not valid." );
39  }
40  $this->callback = $callback;
41  }
42 
49  public static function consume( ScopedCallback &$sc = null ) {
50  $sc = null;
51  }
52 
58  public static function cancel( ScopedCallback &$sc = null ) {
59  if ( $sc ) {
60  $sc->callback = null;
61  }
62  $sc = null;
63  }
64 
68  function __destruct() {
69  if ( $this->callback !== null ) {
70  call_user_func( $this->callback );
71  }
72  }
73 }
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
ScopedCallback\$callback
callable $callback
Definition: ScopedCallback.php:29
ScopedCallback
Class for asserting that a callback happens when an dummy object leaves scope.
Definition: ScopedCallback.php:28
ScopedCallback\__destruct
__destruct()
Trigger the callback when this leaves scope.
Definition: ScopedCallback.php:67
ScopedCallback\__construct
__construct( $callback)
Definition: ScopedCallback.php:35
ScopedCallback\consume
static consume(ScopedCallback &$sc=null)
Trigger a scoped callback and destroy it.
Definition: ScopedCallback.php:48
ScopedCallback\cancel
static cancel(ScopedCallback &$sc=null)
Destroy a scoped callback without triggering it.
Definition: ScopedCallback.php:57