@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | public function addNamespace($namespace, $baseDirectory, $prepend = false) |
| 104 | 104 | { |
| 105 | 105 | // normalize namespace prefix |
| 106 | - $namespace = trim($namespace, '\\') . '\\'; |
|
| 106 | + $namespace = trim($namespace, '\\').'\\'; |
|
| 107 | 107 | |
| 108 | 108 | if (empty($namespace) OR $namespace === '\\') { |
| 109 | 109 | return; |
@@ -111,24 +111,24 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | // normalize the base directory with a trailing separator |
| 113 | 113 | $baseDirectory = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $baseDirectory); |
| 114 | - $baseDirectory = rtrim($baseDirectory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
|
| 114 | + $baseDirectory = rtrim($baseDirectory, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; |
|
| 115 | 115 | |
| 116 | 116 | if (is_dir($baseDirectory)) { |
| 117 | 117 | // initialize the namespace prefix array |
| 118 | - if (isset($this->namespaceDirs[ $namespace ]) === false) { |
|
| 119 | - $this->namespaceDirs[ $namespace ] = []; |
|
| 118 | + if (isset($this->namespaceDirs[$namespace]) === false) { |
|
| 119 | + $this->namespaceDirs[$namespace] = []; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | // retain the base directory for the namespace prefix |
| 123 | - if ( ! in_array($baseDirectory, $this->namespaceDirs[ $namespace ])) { |
|
| 123 | + if (!in_array($baseDirectory, $this->namespaceDirs[$namespace])) { |
|
| 124 | 124 | if ($prepend) { |
| 125 | - array_unshift($this->namespaceDirs[ $namespace ], $baseDirectory); |
|
| 125 | + array_unshift($this->namespaceDirs[$namespace], $baseDirectory); |
|
| 126 | 126 | } else { |
| 127 | - array_push($this->namespaceDirs[ $namespace ], $baseDirectory); |
|
| 127 | + array_push($this->namespaceDirs[$namespace], $baseDirectory); |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - $this->namespaceDirsMap[ $baseDirectory ] = $namespace; |
|
| 131 | + $this->namespaceDirsMap[$baseDirectory] = $namespace; |
|
| 132 | 132 | |
| 133 | 133 | // Register Namespace Language |
| 134 | 134 | language()->addFilePath($baseDirectory); |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | output()->addFilePath($baseDirectory); |
| 138 | 138 | |
| 139 | 139 | // Autoload Composer |
| 140 | - if (is_file($baseDirectory . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php')) { |
|
| 141 | - require($baseDirectory . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'); |
|
| 140 | + if (is_file($baseDirectory.'vendor'.DIRECTORY_SEPARATOR.'autoload.php')) { |
|
| 141 | + require($baseDirectory.'vendor'.DIRECTORY_SEPARATOR.'autoload.php'); |
|
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | } |
@@ -159,10 +159,10 @@ discard block |
||
| 159 | 159 | $dir = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $dir); |
| 160 | 160 | |
| 161 | 161 | $dir = realpath($dir); |
| 162 | - $dir = rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
|
| 162 | + $dir = rtrim($dir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; |
|
| 163 | 163 | |
| 164 | 164 | if (array_key_exists($dir, $this->namespaceDirsMap)) { |
| 165 | - return $this->namespaceDirsMap[ $dir ]; |
|
| 165 | + return $this->namespaceDirsMap[$dir]; |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | return false; |
@@ -200,10 +200,10 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | public function getNamespaceDirs($namespace) |
| 202 | 202 | { |
| 203 | - $namespace = trim($namespace, '\\') . '\\'; |
|
| 203 | + $namespace = trim($namespace, '\\').'\\'; |
|
| 204 | 204 | |
| 205 | 205 | if (array_key_exists($namespace, $this->namespaceDirs)) { |
| 206 | - return $this->namespaceDirs[ $namespace ]; |
|
| 206 | + return $this->namespaceDirs[$namespace]; |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | return false; |
@@ -226,29 +226,29 @@ discard block |
||
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | if ($this->requireFile($helper)) { |
| 229 | - $this->loadedHelpers[ pathinfo($helper, PATHINFO_FILENAME) ][] = $helper; |
|
| 229 | + $this->loadedHelpers[pathinfo($helper, PATHINFO_FILENAME)][] = $helper; |
|
| 230 | 230 | |
| 231 | 231 | return; |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | $helperDirectories = [ |
| 235 | - PATH_KERNEL . 'Helpers' . DIRECTORY_SEPARATOR, |
|
| 236 | - PATH_REACTOR . 'Helpers' . DIRECTORY_SEPARATOR, |
|
| 237 | - PATH_APP . 'Helpers' . DIRECTORY_SEPARATOR, |
|
| 235 | + PATH_KERNEL.'Helpers'.DIRECTORY_SEPARATOR, |
|
| 236 | + PATH_REACTOR.'Helpers'.DIRECTORY_SEPARATOR, |
|
| 237 | + PATH_APP.'Helpers'.DIRECTORY_SEPARATOR, |
|
| 238 | 238 | ]; |
| 239 | 239 | |
| 240 | - if ( ! array_key_exists($helper, $this->loadedHelpers)) { |
|
| 241 | - $this->loadedHelpers[ $helper ] = []; |
|
| 240 | + if (!array_key_exists($helper, $this->loadedHelpers)) { |
|
| 241 | + $this->loadedHelpers[$helper] = []; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | foreach ($helperDirectories as $helperDirectory) { |
| 245 | 245 | |
| 246 | - $helperFilePath = $helperDirectory . studlycase($helper) . '.php'; |
|
| 246 | + $helperFilePath = $helperDirectory.studlycase($helper).'.php'; |
|
| 247 | 247 | |
| 248 | - if (in_array($helperFilePath, $this->loadedHelpers[ $helper ])) { |
|
| 248 | + if (in_array($helperFilePath, $this->loadedHelpers[$helper])) { |
|
| 249 | 249 | continue; |
| 250 | 250 | } elseif ($this->requireFile($helperFilePath)) { |
| 251 | - $this->loadedHelpers[ $helper ][] = $helperFilePath; |
|
| 251 | + $this->loadedHelpers[$helper][] = $helperFilePath; |
|
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | } |
@@ -324,12 +324,12 @@ discard block |
||
| 324 | 324 | public function loadMappedFile($namespace, $relativeClass) |
| 325 | 325 | { |
| 326 | 326 | // are there any base directories for this namespace prefix? |
| 327 | - if (isset($this->namespaceDirs[ $namespace ]) === false) { |
|
| 327 | + if (isset($this->namespaceDirs[$namespace]) === false) { |
|
| 328 | 328 | return false; |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | // look through base directories for this namespace prefix |
| 332 | - foreach ($this->namespaceDirs[ $namespace ] as $namespaceDirectory) { |
|
| 332 | + foreach ($this->namespaceDirs[$namespace] as $namespaceDirectory) { |
|
| 333 | 333 | |
| 334 | 334 | // replace the namespace prefix with the base directory, |
| 335 | 335 | // replace namespace separators with directory separators |
@@ -97,14 +97,14 @@ discard block |
||
| 97 | 97 | public function optionPath($path) |
| 98 | 98 | { |
| 99 | 99 | $path = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $path); |
| 100 | - $path = PATH_ROOT . str_replace(PATH_ROOT, '', $path); |
|
| 100 | + $path = PATH_ROOT.str_replace(PATH_ROOT, '', $path); |
|
| 101 | 101 | |
| 102 | 102 | if (pathinfo($path, PATHINFO_EXTENSION)) { |
| 103 | 103 | $this->optionFilename(pathinfo($path, PATHINFO_FILENAME)); |
| 104 | 104 | $path = dirname($path); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - $this->optionPath = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
|
| 107 | + $this->optionPath = rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | // ------------------------------------------------------------------------ |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | public function optionFilename($name) |
| 118 | 118 | { |
| 119 | 119 | $name = str_replace('.php', '', $name); |
| 120 | - $this->optionFilename = prepare_filename($name) . '.php'; |
|
| 120 | + $this->optionFilename = prepare_filename($name).'.php'; |
|
| 121 | 121 | |
| 122 | 122 | $this->optionPath = empty($this->optionPath) ? modules()->current()->getRealPath() : $this->optionPath; |
| 123 | 123 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | public function getPhpTemplateFile($filename) |
| 157 | 157 | { |
| 158 | 158 | $directories = [ |
| 159 | - PATH_REACTOR . 'Config' . DIRECTORY_SEPARATOR . 'PhpTemplateFiles', |
|
| 159 | + PATH_REACTOR.'Config'.DIRECTORY_SEPARATOR.'PhpTemplateFiles', |
|
| 160 | 160 | ]; |
| 161 | 161 | |
| 162 | 162 | } |