@@ -103,8 +103,7 @@ discard block |
||
103 | 103 | /** |
104 | 104 | * @param string|null $vendorDir |
105 | 105 | */ |
106 | - public function __construct($vendorDir = null) |
|
107 | - { |
|
106 | + public function __construct($vendorDir = null) { |
|
108 | 107 | $this->vendorDir = $vendorDir; |
109 | 108 | self::initializeIncludeClosure(); |
110 | 109 | } |
@@ -112,8 +111,7 @@ discard block |
||
112 | 111 | /** |
113 | 112 | * @return array<string, list<string>> |
114 | 113 | */ |
115 | - public function getPrefixes() |
|
116 | - { |
|
114 | + public function getPrefixes() { |
|
117 | 115 | if (!empty($this->prefixesPsr0)) { |
118 | 116 | return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); |
119 | 117 | } |
@@ -124,32 +122,28 @@ discard block |
||
124 | 122 | /** |
125 | 123 | * @return array<string, list<string>> |
126 | 124 | */ |
127 | - public function getPrefixesPsr4() |
|
128 | - { |
|
125 | + public function getPrefixesPsr4() { |
|
129 | 126 | return $this->prefixDirsPsr4; |
130 | 127 | } |
131 | 128 | |
132 | 129 | /** |
133 | 130 | * @return list<string> |
134 | 131 | */ |
135 | - public function getFallbackDirs() |
|
136 | - { |
|
132 | + public function getFallbackDirs() { |
|
137 | 133 | return $this->fallbackDirsPsr0; |
138 | 134 | } |
139 | 135 | |
140 | 136 | /** |
141 | 137 | * @return list<string> |
142 | 138 | */ |
143 | - public function getFallbackDirsPsr4() |
|
144 | - { |
|
139 | + public function getFallbackDirsPsr4() { |
|
145 | 140 | return $this->fallbackDirsPsr4; |
146 | 141 | } |
147 | 142 | |
148 | 143 | /** |
149 | 144 | * @return array<string, string> Array of classname => path |
150 | 145 | */ |
151 | - public function getClassMap() |
|
152 | - { |
|
146 | + public function getClassMap() { |
|
153 | 147 | return $this->classMap; |
154 | 148 | } |
155 | 149 | |
@@ -158,11 +152,11 @@ discard block |
||
158 | 152 | * |
159 | 153 | * @return void |
160 | 154 | */ |
161 | - public function addClassMap(array $classMap) |
|
162 | - { |
|
155 | + public function addClassMap(array $classMap) { |
|
163 | 156 | if ($this->classMap) { |
164 | 157 | $this->classMap = array_merge($this->classMap, $classMap); |
165 | - } else { |
|
158 | + } |
|
159 | + else { |
|
166 | 160 | $this->classMap = $classMap; |
167 | 161 | } |
168 | 162 | } |
@@ -177,8 +171,7 @@ discard block |
||
177 | 171 | * |
178 | 172 | * @return void |
179 | 173 | */ |
180 | - public function add($prefix, $paths, $prepend = false) |
|
181 | - { |
|
174 | + public function add($prefix, $paths, $prepend = false) { |
|
182 | 175 | $paths = (array) $paths; |
183 | 176 | if (!$prefix) { |
184 | 177 | if ($prepend) { |
@@ -186,7 +179,8 @@ discard block |
||
186 | 179 | $paths, |
187 | 180 | $this->fallbackDirsPsr0 |
188 | 181 | ); |
189 | - } else { |
|
182 | + } |
|
183 | + else { |
|
190 | 184 | $this->fallbackDirsPsr0 = array_merge( |
191 | 185 | $this->fallbackDirsPsr0, |
192 | 186 | $paths |
@@ -207,7 +201,8 @@ discard block |
||
207 | 201 | $paths, |
208 | 202 | $this->prefixesPsr0[$first][$prefix] |
209 | 203 | ); |
210 | - } else { |
|
204 | + } |
|
205 | + else { |
|
211 | 206 | $this->prefixesPsr0[$first][$prefix] = array_merge( |
212 | 207 | $this->prefixesPsr0[$first][$prefix], |
213 | 208 | $paths |
@@ -227,8 +222,7 @@ discard block |
||
227 | 222 | * |
228 | 223 | * @return void |
229 | 224 | */ |
230 | - public function addPsr4($prefix, $paths, $prepend = false) |
|
231 | - { |
|
225 | + public function addPsr4($prefix, $paths, $prepend = false) { |
|
232 | 226 | $paths = (array) $paths; |
233 | 227 | if (!$prefix) { |
234 | 228 | // Register directories for the root namespace. |
@@ -237,13 +231,15 @@ discard block |
||
237 | 231 | $paths, |
238 | 232 | $this->fallbackDirsPsr4 |
239 | 233 | ); |
240 | - } else { |
|
234 | + } |
|
235 | + else { |
|
241 | 236 | $this->fallbackDirsPsr4 = array_merge( |
242 | 237 | $this->fallbackDirsPsr4, |
243 | 238 | $paths |
244 | 239 | ); |
245 | 240 | } |
246 | - } elseif (!isset($this->prefixDirsPsr4[$prefix])) { |
|
241 | + } |
|
242 | + elseif (!isset($this->prefixDirsPsr4[$prefix])) { |
|
247 | 243 | // Register directories for a new namespace. |
248 | 244 | $length = strlen($prefix); |
249 | 245 | if ('\\' !== $prefix[$length - 1]) { |
@@ -251,13 +247,15 @@ discard block |
||
251 | 247 | } |
252 | 248 | $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; |
253 | 249 | $this->prefixDirsPsr4[$prefix] = $paths; |
254 | - } elseif ($prepend) { |
|
250 | + } |
|
251 | + elseif ($prepend) { |
|
255 | 252 | // Prepend directories for an already registered namespace. |
256 | 253 | $this->prefixDirsPsr4[$prefix] = array_merge( |
257 | 254 | $paths, |
258 | 255 | $this->prefixDirsPsr4[$prefix] |
259 | 256 | ); |
260 | - } else { |
|
257 | + } |
|
258 | + else { |
|
261 | 259 | // Append directories for an already registered namespace. |
262 | 260 | $this->prefixDirsPsr4[$prefix] = array_merge( |
263 | 261 | $this->prefixDirsPsr4[$prefix], |
@@ -275,11 +273,11 @@ discard block |
||
275 | 273 | * |
276 | 274 | * @return void |
277 | 275 | */ |
278 | - public function set($prefix, $paths) |
|
279 | - { |
|
276 | + public function set($prefix, $paths) { |
|
280 | 277 | if (!$prefix) { |
281 | 278 | $this->fallbackDirsPsr0 = (array) $paths; |
282 | - } else { |
|
279 | + } |
|
280 | + else { |
|
283 | 281 | $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; |
284 | 282 | } |
285 | 283 | } |
@@ -295,11 +293,11 @@ discard block |
||
295 | 293 | * |
296 | 294 | * @return void |
297 | 295 | */ |
298 | - public function setPsr4($prefix, $paths) |
|
299 | - { |
|
296 | + public function setPsr4($prefix, $paths) { |
|
300 | 297 | if (!$prefix) { |
301 | 298 | $this->fallbackDirsPsr4 = (array) $paths; |
302 | - } else { |
|
299 | + } |
|
300 | + else { |
|
303 | 301 | $length = strlen($prefix); |
304 | 302 | if ('\\' !== $prefix[$length - 1]) { |
305 | 303 | throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); |
@@ -316,8 +314,7 @@ discard block |
||
316 | 314 | * |
317 | 315 | * @return void |
318 | 316 | */ |
319 | - public function setUseIncludePath($useIncludePath) |
|
320 | - { |
|
317 | + public function setUseIncludePath($useIncludePath) { |
|
321 | 318 | $this->useIncludePath = $useIncludePath; |
322 | 319 | } |
323 | 320 | |
@@ -327,8 +324,7 @@ discard block |
||
327 | 324 | * |
328 | 325 | * @return bool |
329 | 326 | */ |
330 | - public function getUseIncludePath() |
|
331 | - { |
|
327 | + public function getUseIncludePath() { |
|
332 | 328 | return $this->useIncludePath; |
333 | 329 | } |
334 | 330 | |
@@ -340,8 +336,7 @@ discard block |
||
340 | 336 | * |
341 | 337 | * @return void |
342 | 338 | */ |
343 | - public function setClassMapAuthoritative($classMapAuthoritative) |
|
344 | - { |
|
339 | + public function setClassMapAuthoritative($classMapAuthoritative) { |
|
345 | 340 | $this->classMapAuthoritative = $classMapAuthoritative; |
346 | 341 | } |
347 | 342 | |
@@ -350,8 +345,7 @@ discard block |
||
350 | 345 | * |
351 | 346 | * @return bool |
352 | 347 | */ |
353 | - public function isClassMapAuthoritative() |
|
354 | - { |
|
348 | + public function isClassMapAuthoritative() { |
|
355 | 349 | return $this->classMapAuthoritative; |
356 | 350 | } |
357 | 351 | |
@@ -362,8 +356,7 @@ discard block |
||
362 | 356 | * |
363 | 357 | * @return void |
364 | 358 | */ |
365 | - public function setApcuPrefix($apcuPrefix) |
|
366 | - { |
|
359 | + public function setApcuPrefix($apcuPrefix) { |
|
367 | 360 | $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; |
368 | 361 | } |
369 | 362 | |
@@ -372,8 +365,7 @@ discard block |
||
372 | 365 | * |
373 | 366 | * @return string|null |
374 | 367 | */ |
375 | - public function getApcuPrefix() |
|
376 | - { |
|
368 | + public function getApcuPrefix() { |
|
377 | 369 | return $this->apcuPrefix; |
378 | 370 | } |
379 | 371 | |
@@ -384,8 +376,7 @@ discard block |
||
384 | 376 | * |
385 | 377 | * @return void |
386 | 378 | */ |
387 | - public function register($prepend = false) |
|
388 | - { |
|
379 | + public function register($prepend = false) { |
|
389 | 380 | spl_autoload_register(array($this, 'loadClass'), true, $prepend); |
390 | 381 | |
391 | 382 | if (null === $this->vendorDir) { |
@@ -394,7 +385,8 @@ discard block |
||
394 | 385 | |
395 | 386 | if ($prepend) { |
396 | 387 | self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; |
397 | - } else { |
|
388 | + } |
|
389 | + else { |
|
398 | 390 | unset(self::$registeredLoaders[$this->vendorDir]); |
399 | 391 | self::$registeredLoaders[$this->vendorDir] = $this; |
400 | 392 | } |
@@ -405,8 +397,7 @@ discard block |
||
405 | 397 | * |
406 | 398 | * @return void |
407 | 399 | */ |
408 | - public function unregister() |
|
409 | - { |
|
400 | + public function unregister() { |
|
410 | 401 | spl_autoload_unregister(array($this, 'loadClass')); |
411 | 402 | |
412 | 403 | if (null !== $this->vendorDir) { |
@@ -420,8 +411,7 @@ discard block |
||
420 | 411 | * @param string $class The name of the class |
421 | 412 | * @return true|null True if loaded, null otherwise |
422 | 413 | */ |
423 | - public function loadClass($class) |
|
424 | - { |
|
414 | + public function loadClass($class) { |
|
425 | 415 | if ($file = $this->findFile($class)) { |
426 | 416 | $includeFile = self::$includeFile; |
427 | 417 | $includeFile($file); |
@@ -439,8 +429,7 @@ discard block |
||
439 | 429 | * |
440 | 430 | * @return string|false The path if found, false otherwise |
441 | 431 | */ |
442 | - public function findFile($class) |
|
443 | - { |
|
432 | + public function findFile($class) { |
|
444 | 433 | // class map lookup |
445 | 434 | if (isset($this->classMap[$class])) { |
446 | 435 | return $this->classMap[$class]; |
@@ -479,8 +468,7 @@ discard block |
||
479 | 468 | * |
480 | 469 | * @return array<string, self> |
481 | 470 | */ |
482 | - public static function getRegisteredLoaders() |
|
483 | - { |
|
471 | + public static function getRegisteredLoaders() { |
|
484 | 472 | return self::$registeredLoaders; |
485 | 473 | } |
486 | 474 | |
@@ -489,8 +477,7 @@ discard block |
||
489 | 477 | * @param string $ext |
490 | 478 | * @return string|false |
491 | 479 | */ |
492 | - private function findFileWithExtension($class, $ext) |
|
493 | - { |
|
480 | + private function findFileWithExtension($class, $ext) { |
|
494 | 481 | // PSR-4 lookup |
495 | 482 | $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
496 | 483 | |
@@ -523,7 +510,8 @@ discard block |
||
523 | 510 | // namespaced class name |
524 | 511 | $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) |
525 | 512 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
526 | - } else { |
|
513 | + } |
|
514 | + else { |
|
527 | 515 | // PEAR-like class name |
528 | 516 | $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
529 | 517 | } |
@@ -558,8 +546,7 @@ discard block |
||
558 | 546 | /** |
559 | 547 | * @return void |
560 | 548 | */ |
561 | - private static function initializeIncludeClosure() |
|
562 | - { |
|
549 | + private static function initializeIncludeClosure() { |
|
563 | 550 | if (self::$includeFile !== null) { |
564 | 551 | return; |
565 | 552 | } |
@@ -6,8 +6,7 @@ discard block |
||
6 | 6 | { |
7 | 7 | private static $loader; |
8 | 8 | |
9 | - public static function loadClassLoader($class) |
|
10 | - { |
|
9 | + public static function loadClassLoader($class) { |
|
11 | 10 | if ('Composer\Autoload\ClassLoader' === $class) { |
12 | 11 | require __DIR__ . '/ClassLoader.php'; |
13 | 12 | } |
@@ -16,8 +15,7 @@ discard block |
||
16 | 15 | /** |
17 | 16 | * @return \Composer\Autoload\ClassLoader |
18 | 17 | */ |
19 | - public static function getLoader() |
|
20 | - { |
|
18 | + public static function getLoader() { |
|
21 | 19 | if (null !== self::$loader) { |
22 | 20 | return self::$loader; |
23 | 21 | } |
@@ -10,7 +10,8 @@ |
||
10 | 10 | if (!ini_get('display_errors')) { |
11 | 11 | if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { |
12 | 12 | fwrite(STDERR, $err); |
13 | - } elseif (!headers_sent()) { |
|
13 | + } |
|
14 | + elseif (!headers_sent()) { |
|
14 | 15 | echo $err; |
15 | 16 | } |
16 | 17 | } |