@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | /** @type \BuildR\ClassLoader\Modules\ClassLoaderModuleInterface $module */ |
| 86 | 86 | $module = $this->moduleLoader->preLoad($moduleClassName); |
| 87 | 87 | |
| 88 | - if($priorityOverride !== NULL) { |
|
| 88 | + if ($priorityOverride !== NULL) { |
|
| 89 | 89 | $module->setPriority($priorityOverride); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public function getModule($moduleName, $priority) { |
| 107 | 107 | foreach ($this->modules as $modulePriority => $module) { |
| 108 | - if(call_user_func([$module, 'getName']) === $moduleName && $modulePriority == $priority) { |
|
| 108 | + if (call_user_func([$module, 'getName']) === $moduleName && $modulePriority == $priority) { |
|
| 109 | 109 | return $module; |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public function removeModule($moduleName, $priority) { |
| 128 | 128 | foreach ($this->modules as $modulePriority => $module) { |
| 129 | - if(call_user_func([$module, 'getName']) === $moduleName && $modulePriority == $priority) { |
|
| 129 | + if (call_user_func([$module, 'getName']) === $moduleName && $modulePriority == $priority) { |
|
| 130 | 130 | unset($this->modules[$priority]); |
| 131 | 131 | ksort($this->modules); |
| 132 | 132 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | protected function registerModule(ClassLoaderModuleInterface $module) { |
| 160 | 160 | $priority = $module->getPriority(); |
| 161 | 161 | |
| 162 | - if(!isset($this->modules[$priority])) { |
|
| 162 | + if (!isset($this->modules[$priority])) { |
|
| 163 | 163 | $this->modules[$priority] = $module; |
| 164 | 164 | $this->priorityIncreaseCounter = 0; |
| 165 | 165 | ksort($this->modules); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | return $module; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - if($this->priorityIncreaseCounter >= self::PRIORITY_INCREASE_RETRY_COUNT) { |
|
| 171 | + if ($this->priorityIncreaseCounter >= self::PRIORITY_INCREASE_RETRY_COUNT) { |
|
| 172 | 172 | $this->priorityIncreaseCounter = 0; |
| 173 | 173 | throw ClassLoaderException::priorityIncreaseLimit(); |
| 174 | 174 | } |
@@ -193,8 +193,8 @@ discard block |
||
| 193 | 193 | * @return bool |
| 194 | 194 | */ |
| 195 | 195 | public function loadClass($className) { |
| 196 | - foreach($this->modules as $loader) { |
|
| 197 | - if($loader->load($className) === TRUE) { |
|
| 196 | + foreach ($this->modules as $loader) { |
|
| 197 | + if ($loader->load($className) === TRUE) { |
|
| 198 | 198 | return TRUE; |
| 199 | 199 | } |
| 200 | 200 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * @param $additionalFile |
| 42 | 42 | */ |
| 43 | 43 | public static function extend($additionalFile) { |
| 44 | - if(self::$isLoaded === TRUE) { |
|
| 44 | + if (self::$isLoaded === TRUE) { |
|
| 45 | 45 | trigger_error('The initializer is loaded, so you cannot extend a loaded initializer!', E_USER_NOTICE); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -63,14 +63,14 @@ discard block |
||
| 63 | 63 | * @return void |
| 64 | 64 | */ |
| 65 | 65 | public static function load() { |
| 66 | - if(self::$isLoaded === TRUE) { |
|
| 66 | + if (self::$isLoaded === TRUE) { |
|
| 67 | 67 | trigger_error("Unable to load ClassLoader because its already loaded!", E_USER_NOTICE); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | $rootDir = __DIR__ . DIRECTORY_SEPARATOR; |
| 71 | 71 | ksort(self::$files); |
| 72 | 72 | |
| 73 | - foreach(self::$files as $priority => $file) { |
|
| 73 | + foreach (self::$files as $priority => $file) { |
|
| 74 | 74 | $fileAbsolute = $rootDir . $file; |
| 75 | 75 | |
| 76 | 76 | include_once $fileAbsolute; |
@@ -33,13 +33,13 @@ |
||
| 33 | 33 | public function preLoad($moduleClassName) { |
| 34 | 34 | $interfaces = class_implements($moduleClassName); |
| 35 | 35 | |
| 36 | - if(!in_array(ClassLoaderModuleInterface::class, $interfaces)) { |
|
| 36 | + if (!in_array(ClassLoaderModuleInterface::class, $interfaces)) { |
|
| 37 | 37 | throw ModuleException::invalid($moduleClassName); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | $preloadedFiles = (array) call_user_func([$moduleClassName, 'getAdditionalModuleFiles']); |
| 41 | 41 | |
| 42 | - foreach($preloadedFiles as $file) { |
|
| 42 | + foreach ($preloadedFiles as $file) { |
|
| 43 | 43 | include_once $file; |
| 44 | 44 | } |
| 45 | 45 | |
@@ -59,15 +59,15 @@ discard block |
||
| 59 | 59 | * @inheritDoc |
| 60 | 60 | */ |
| 61 | 61 | public function load($className) { |
| 62 | - if(count($this->registeredMaps) < 1) { |
|
| 62 | + if (count($this->registeredMaps) < 1) { |
|
| 63 | 63 | return FALSE; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - foreach($this->registeredMaps as $mapName => $map) { |
|
| 67 | - if(isset($map[$className])) { |
|
| 66 | + foreach ($this->registeredMaps as $mapName => $map) { |
|
| 67 | + if (isset($map[$className])) { |
|
| 68 | 68 | $classFile = $map[$className]; |
| 69 | 69 | |
| 70 | - if(file_exists($classFile)) { |
|
| 70 | + if (file_exists($classFile)) { |
|
| 71 | 71 | include_once $classFile; |
| 72 | 72 | |
| 73 | 73 | return TRUE; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @throws \BuildR\ClassLoader\Modules\Map\MapModuleException |
| 88 | 88 | */ |
| 89 | 89 | public function registerMap($mapName, $map) { |
| 90 | - if($this->mapIsRegistered($mapName)) { |
|
| 90 | + if ($this->mapIsRegistered($mapName)) { |
|
| 91 | 91 | throw MapModuleException::mapNameOccupied($mapName); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * @return bool |
| 103 | 103 | */ |
| 104 | 104 | public function removeMap($mapName) { |
| 105 | - if(!$this->mapIsRegistered($mapName)) { |
|
| 105 | + if (!$this->mapIsRegistered($mapName)) { |
|
| 106 | 106 | return FALSE; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -59,22 +59,22 @@ discard block |
||
| 59 | 59 | * @inheritDoc |
| 60 | 60 | */ |
| 61 | 61 | public function load($className) { |
| 62 | - if(count($this->registeredPrefixes) < 1) { |
|
| 62 | + if (count($this->registeredPrefixes) < 1) { |
|
| 63 | 63 | return FALSE; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - foreach($this->registeredPrefixes as $singlePrefix) { |
|
| 66 | + foreach ($this->registeredPrefixes as $singlePrefix) { |
|
| 67 | 67 | $prefix = $singlePrefix[0]; |
| 68 | 68 | $basePath = $singlePrefix[1]; |
| 69 | 69 | |
| 70 | 70 | $pos = strpos($className, $prefix); |
| 71 | - if($pos === FALSE || $pos > 0) { |
|
| 71 | + if ($pos === FALSE || $pos > 0) { |
|
| 72 | 72 | continue; |
| 73 | 73 | } |
| 74 | 74 | $pathNamespace = ltrim(substr($className, strlen($prefix)), '_'); |
| 75 | 75 | $file = $basePath . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $pathNamespace) . '.php'; |
| 76 | 76 | |
| 77 | - if(file_exists($file)) { |
|
| 77 | + if (file_exists($file)) { |
|
| 78 | 78 | include_once $file; |
| 79 | 79 | |
| 80 | 80 | return TRUE; |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | public function registerPrefix($prefix, $basePath) { |
| 88 | - if($this->prefixIsRegistered($prefix)) { |
|
| 88 | + if ($this->prefixIsRegistered($prefix)) { |
|
| 89 | 89 | throw PEARModuleException::prefixOccupied($prefix); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | * @param string $prefix The prefix name |
| 102 | 102 | */ |
| 103 | 103 | public function unRegisterPrefix($prefix) { |
| 104 | - foreach($this->registeredPrefixes as $key => $registeredPrefix) { |
|
| 105 | - if($registeredPrefix[0] == $prefix) { |
|
| 104 | + foreach ($this->registeredPrefixes as $key => $registeredPrefix) { |
|
| 105 | + if ($registeredPrefix[0] == $prefix) { |
|
| 106 | 106 | unset($this->registeredPrefixes[$key]); |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -116,8 +116,8 @@ discard block |
||
| 116 | 116 | * @return bool |
| 117 | 117 | */ |
| 118 | 118 | public function prefixIsRegistered($prefix) { |
| 119 | - foreach($this->registeredPrefixes as $key => $registeredPrefix) { |
|
| 120 | - if($registeredPrefix[0] == $prefix) { |
|
| 119 | + foreach ($this->registeredPrefixes as $key => $registeredPrefix) { |
|
| 120 | + if ($registeredPrefix[0] == $prefix) { |
|
| 121 | 121 | return TRUE; |
| 122 | 122 | } |
| 123 | 123 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @inheritDoc |
| 61 | 61 | */ |
| 62 | 62 | public function load($className) { |
| 63 | - if(count($this->registeredNamespaces) < 1) { |
|
| 63 | + if (count($this->registeredNamespaces) < 1) { |
|
| 64 | 64 | return FALSE; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -74,19 +74,19 @@ discard block |
||
| 74 | 74 | $normalizedClass .= str_replace('_', DIRECTORY_SEPARATOR, $className); |
| 75 | 75 | |
| 76 | 76 | //Loop through registered namespaces |
| 77 | - foreach($this->registeredNamespaces as $singleNamespace) { |
|
| 77 | + foreach ($this->registeredNamespaces as $singleNamespace) { |
|
| 78 | 78 | $prefix = str_replace('\\', DIRECTORY_SEPARATOR, $singleNamespace[0]); |
| 79 | 79 | $basePath = $singleNamespace[1]; |
| 80 | 80 | |
| 81 | 81 | $pos = stripos($normalizedClass, $prefix); |
| 82 | - if($pos === FALSE || $pos > 1) { |
|
| 82 | + if ($pos === FALSE || $pos > 1) { |
|
| 83 | 83 | continue; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | // build the full path |
| 87 | 87 | $file = rtrim($basePath, '/') . DIRECTORY_SEPARATOR . ltrim($normalizedClass, '/') . '.php'; |
| 88 | 88 | |
| 89 | - if(file_exists($file)) { |
|
| 89 | + if (file_exists($file)) { |
|
| 90 | 90 | include_once $file; |
| 91 | 91 | |
| 92 | 92 | return TRUE; |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * @throws \BuildR\ClassLoader\Modules\PSR0\PSR0ModuleException |
| 103 | 103 | */ |
| 104 | 104 | public function registerNamespace($namespace, $basePath) { |
| 105 | - if($this->namespaceIsRegistered($namespace)) { |
|
| 105 | + if ($this->namespaceIsRegistered($namespace)) { |
|
| 106 | 106 | throw PSR0ModuleException::namespaceOccupied($namespace); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -118,8 +118,8 @@ discard block |
||
| 118 | 118 | * @param string $namespace The namespace name |
| 119 | 119 | */ |
| 120 | 120 | public function unRegisterNamespace($namespace) { |
| 121 | - foreach($this->registeredNamespaces as $key => $registeredNamespace) { |
|
| 122 | - if($registeredNamespace[0] == $namespace) { |
|
| 121 | + foreach ($this->registeredNamespaces as $key => $registeredNamespace) { |
|
| 122 | + if ($registeredNamespace[0] == $namespace) { |
|
| 123 | 123 | unset($this->registeredNamespaces[$key]); |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | * @return bool |
| 134 | 134 | */ |
| 135 | 135 | public function namespaceIsRegistered($namespace) { |
| 136 | - foreach($this->registeredNamespaces as $key => $registeredNamespace) { |
|
| 137 | - if($registeredNamespace[0] == $namespace) { |
|
| 136 | + foreach ($this->registeredNamespaces as $key => $registeredNamespace) { |
|
| 137 | + if ($registeredNamespace[0] == $namespace) { |
|
| 138 | 138 | return TRUE; |
| 139 | 139 | } |
| 140 | 140 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * @inheritDoc |
| 62 | 62 | */ |
| 63 | 63 | public function load($className) { |
| 64 | - if(count($this->registeredNamespaces) < 1) { |
|
| 64 | + if (count($this->registeredNamespaces) < 1) { |
|
| 65 | 65 | return FALSE; |
| 66 | 66 | } |
| 67 | 67 | |
@@ -70,14 +70,14 @@ discard block |
||
| 70 | 70 | $basePath = $singleNamespace[1]; |
| 71 | 71 | |
| 72 | 72 | $prefixLength = strlen($prefix); |
| 73 | - if(strncmp($prefix, $className, $prefixLength) !== 0) { |
|
| 73 | + if (strncmp($prefix, $className, $prefixLength) !== 0) { |
|
| 74 | 74 | continue; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $relativeClassName = substr($className, $prefixLength); |
| 78 | 78 | $fileLocation = $basePath . str_replace('\\', DIRECTORY_SEPARATOR, $relativeClassName) . '.php'; |
| 79 | 79 | |
| 80 | - if(file_exists($fileLocation)) { |
|
| 80 | + if (file_exists($fileLocation)) { |
|
| 81 | 81 | include_once $fileLocation; |
| 82 | 82 | |
| 83 | 83 | return TRUE; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @throws \BuildR\ClassLoader\Modules\PSR4\PSR4ModuleException |
| 97 | 97 | */ |
| 98 | 98 | public function registerNamespace($namespace, $basePath) { |
| 99 | - if($this->namespaceIsRegistered($namespace)) { |
|
| 99 | + if ($this->namespaceIsRegistered($namespace)) { |
|
| 100 | 100 | throw PSR4ModuleException::namespaceOccupied($namespace); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | * @param string $namespace The namespace name |
| 113 | 113 | */ |
| 114 | 114 | public function unRegisterNamespace($namespace) { |
| 115 | - foreach($this->registeredNamespaces as $key => $registeredNamespace) { |
|
| 116 | - if($registeredNamespace[0] == $namespace) { |
|
| 115 | + foreach ($this->registeredNamespaces as $key => $registeredNamespace) { |
|
| 116 | + if ($registeredNamespace[0] == $namespace) { |
|
| 117 | 117 | unset($this->registeredNamespaces[$key]); |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | * @return bool |
| 128 | 128 | */ |
| 129 | 129 | public function namespaceIsRegistered($namespace) { |
| 130 | - foreach($this->registeredNamespaces as $key => $registeredNamespace) { |
|
| 131 | - if($registeredNamespace[0] == $namespace) { |
|
| 130 | + foreach ($this->registeredNamespaces as $key => $registeredNamespace) { |
|
| 131 | + if ($registeredNamespace[0] == $namespace) { |
|
| 132 | 132 | return TRUE; |
| 133 | 133 | } |
| 134 | 134 | } |
@@ -57,14 +57,14 @@ discard block |
||
| 57 | 57 | * @inheritDoc |
| 58 | 58 | */ |
| 59 | 59 | public function load($className) { |
| 60 | - if(count($this->registeredTransformers) < 1) { |
|
| 60 | + if (count($this->registeredTransformers) < 1) { |
|
| 61 | 61 | return FALSE; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - foreach($this->registeredTransformers as $name => $transformerCallable) { |
|
| 64 | + foreach ($this->registeredTransformers as $name => $transformerCallable) { |
|
| 65 | 65 | $transformerResult = call_user_func_array($transformerCallable, [$className]); |
| 66 | 66 | |
| 67 | - if($transformerResult !== FALSE && file_exists($transformerResult)) { |
|
| 67 | + if ($transformerResult !== FALSE && file_exists($transformerResult)) { |
|
| 68 | 68 | include_once $transformerResult; |
| 69 | 69 | |
| 70 | 70 | return TRUE; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | * @throws \BuildR\ClassLoader\Modules\Transformable\TransformableModuleException |
| 84 | 84 | */ |
| 85 | 85 | public function registerTransformer($name, callable $transformer) { |
| 86 | - if($this->transformerIsRegistered($name)) { |
|
| 86 | + if ($this->transformerIsRegistered($name)) { |
|
| 87 | 87 | throw TransformableModuleException::nameOccupied($name); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @return bool |
| 99 | 99 | */ |
| 100 | 100 | public function removeTransformer($name) { |
| 101 | - if($this->transformerIsRegistered($name)) { |
|
| 101 | + if ($this->transformerIsRegistered($name)) { |
|
| 102 | 102 | unset($this->registeredTransformers[$name]); |
| 103 | 103 | |
| 104 | 104 | return TRUE; |