@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | * @throws \Exception |
| 25 | 25 | */ |
| 26 | 26 | public function __construct() { |
| 27 | - if ( ! isset( $GLOBALS[ 'wgVersion' ] ) || version_compare( $GLOBALS[ 'wgVersion' ], '1.27', '<' ) ) { |
|
| 28 | - throw new \Exception( 'ExtensionRegistryHelper requires MediaWiki 1.27 or above.' ); |
|
| 27 | + if (!isset($GLOBALS[ 'wgVersion' ]) || version_compare($GLOBALS[ 'wgVersion' ], '1.27', '<')) { |
|
| 28 | + throw new \Exception('ExtensionRegistryHelper requires MediaWiki 1.27 or above.'); |
|
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @throws \Exception |
| 36 | 36 | */ |
| 37 | 37 | public static function singleton() { |
| 38 | - if ( !self::$singleton ) { |
|
| 38 | + if (!self::$singleton) { |
|
| 39 | 39 | self::$singleton = new self(); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @throws \Exception |
| 50 | 50 | */ |
| 51 | - public function loadExtensionRecursive( $extensionName, $path = null ) { |
|
| 51 | + public function loadExtensionRecursive($extensionName, $path = null) { |
|
| 52 | 52 | $path = $path ?: $GLOBALS[ 'wgExtensionDirectory' ] . '/' . $extensionName . '/extension.json'; |
| 53 | - $this->loadModuleRecursive( $extensionName, $path ); |
|
| 53 | + $this->loadModuleRecursive($extensionName, $path); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -59,9 +59,9 @@ discard block |
||
| 59 | 59 | * |
| 60 | 60 | * @throws \Exception |
| 61 | 61 | */ |
| 62 | - public function loadSkinRecursive( $skinName, $path = null ) { |
|
| 62 | + public function loadSkinRecursive($skinName, $path = null) { |
|
| 63 | 63 | $path = $path ?: $GLOBALS[ 'wgStyleDirectory' ] . '/' . $skinName . '/skin.json'; |
| 64 | - $this->loadModuleRecursive( $skinName, $path ); |
|
| 64 | + $this->loadModuleRecursive($skinName, $path); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -69,21 +69,21 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @throws \Exception |
| 71 | 71 | */ |
| 72 | - protected function loadModuleRecursive( $moduleName, $path ) { |
|
| 72 | + protected function loadModuleRecursive($moduleName, $path) { |
|
| 73 | 73 | |
| 74 | 74 | $extensionRegistry = \ExtensionRegistry::getInstance(); |
| 75 | 75 | |
| 76 | - if ( !$extensionRegistry->isLoaded( $moduleName ) && !array_key_exists( $path, $extensionRegistry->getQueue() ) ) { |
|
| 76 | + if (!$extensionRegistry->isLoaded($moduleName) && !array_key_exists($path, $extensionRegistry->getQueue())) { |
|
| 77 | 77 | |
| 78 | 78 | $subregistry = new \ExtensionRegistry(); |
| 79 | - $subregistry->load( $path ); |
|
| 79 | + $subregistry->load($path); |
|
| 80 | 80 | |
| 81 | 81 | try { |
| 82 | - $loadedRefl = new \ReflectionProperty( \ExtensionRegistry::class, 'loaded' ); |
|
| 83 | - $loadedRefl->setAccessible( true ); |
|
| 84 | - $loadedRefl->setValue( $extensionRegistry, $extensionRegistry->getAllThings() + $subregistry->getAllThings() ); |
|
| 85 | - } catch ( \Exception $e ) { |
|
| 86 | - throw new \Exception( 'This version of MediaWiki does not support ExtensionRegistryHelper.', 0, $e ); |
|
| 82 | + $loadedRefl = new \ReflectionProperty(\ExtensionRegistry::class, 'loaded'); |
|
| 83 | + $loadedRefl->setAccessible(true); |
|
| 84 | + $loadedRefl->setValue($extensionRegistry, $extensionRegistry->getAllThings() + $subregistry->getAllThings()); |
|
| 85 | + } catch (\Exception $e) { |
|
| 86 | + throw new \Exception('This version of MediaWiki does not support ExtensionRegistryHelper.', 0, $e); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | } |
@@ -12,11 +12,11 @@ |
||
| 12 | 12 | /** |
| 13 | 13 | * @throws \Exception |
| 14 | 14 | */ |
| 15 | - public function testGetSingleton(){ |
|
| 15 | + public function testGetSingleton() { |
|
| 16 | 16 | |
| 17 | 17 | $GLOBALS[ 'wgVersion' ] = '1.27'; |
| 18 | 18 | $helper = ExtensionRegistryHelper::singleton(); |
| 19 | - self::assertInstanceOf( ExtensionRegistryHelper::class, $helper ); |
|
| 19 | + self::assertInstanceOf(ExtensionRegistryHelper::class, $helper); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | } |