X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Ffilebackend%2Flockmanager%2FLockManagerGroup.php;h=602b876b8ad81007574af2e74557815b27da4408;hb=fd8a5d468934398595874783fa75ae2bf1b2b482;hp=19fc4fef4360664a1ff3cee8b80a5e59b5e378c7;hpb=222727927abfe04a3116e4f7671e7628b14fe661;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/filebackend/lockmanager/LockManagerGroup.php b/includes/filebackend/lockmanager/LockManagerGroup.php index 19fc4fef43..602b876b8a 100644 --- a/includes/filebackend/lockmanager/LockManagerGroup.php +++ b/includes/filebackend/lockmanager/LockManagerGroup.php @@ -30,12 +30,12 @@ */ class LockManagerGroup { /** @var array (domain => LockManager) */ - protected static $instances = array(); + protected static $instances = []; protected $domain; // string; domain (usually wiki ID) /** @var array Array of (name => ('class' => ..., 'config' => ..., 'instance' => ...)) */ - protected $managers = array(); + protected $managers = []; /** * @param string $domain Domain (usually wiki ID) @@ -62,7 +62,7 @@ class LockManagerGroup { * Destroy the singleton instances */ public static function destroySingletons() { - self::$instances = array(); + self::$instances = []; } /** @@ -78,25 +78,25 @@ class LockManagerGroup { * Register an array of file lock manager configurations * * @param array $configs - * @throws MWException + * @throws Exception */ protected function register( array $configs ) { foreach ( $configs as $config ) { $config['domain'] = $this->domain; if ( !isset( $config['name'] ) ) { - throw new MWException( "Cannot register a lock manager with no name." ); + throw new Exception( "Cannot register a lock manager with no name." ); } $name = $config['name']; if ( !isset( $config['class'] ) ) { - throw new MWException( "Cannot register lock manager `{$name}` with no class." ); + throw new Exception( "Cannot register lock manager `{$name}` with no class." ); } $class = $config['class']; unset( $config['class'] ); // lock manager won't need this - $this->managers[$name] = array( + $this->managers[$name] = [ 'class' => $class, 'config' => $config, 'instance' => null - ); + ]; } } @@ -105,11 +105,11 @@ class LockManagerGroup { * * @param string $name * @return LockManager - * @throws MWException + * @throws Exception */ public function get( $name ) { if ( !isset( $this->managers[$name] ) ) { - throw new MWException( "No lock manager defined with the name `$name`." ); + throw new Exception( "No lock manager defined with the name `$name`." ); } // Lazy-load the actual lock manager instance if ( !isset( $this->managers[$name]['instance'] ) ) { @@ -126,15 +126,15 @@ class LockManagerGroup { * * @param string $name * @return array - * @throws MWException + * @throws Exception */ public function config( $name ) { if ( !isset( $this->managers[$name] ) ) { - throw new MWException( "No lock manager defined with the name `$name`." ); + throw new Exception( "No lock manager defined with the name `$name`." ); } $class = $this->managers[$name]['class']; - return array( 'class' => $class ) + $this->managers[$name]['config']; + return [ 'class' => $class ] + $this->managers[$name]['config']; } /** @@ -146,7 +146,7 @@ class LockManagerGroup { public function getDefault() { return isset( $this->managers['default'] ) ? $this->get( 'default' ) - : new NullLockManager( array() ); + : new NullLockManager( [] ); } /** @@ -155,7 +155,7 @@ class LockManagerGroup { * Throws an exception if no lock manager could be found. * * @return LockManager - * @throws MWException + * @throws Exception */ public function getAny() { return isset( $this->managers['default'] )