@@ -117,7 +117,7 @@ |
||
| 117 | 117 | self::initClassMap(); |
| 118 | 118 | if (null === self::$optimisedClassMap && !class_exists(ClassMapGenerator::class)) { |
| 119 | 119 | throw new Exception('Cruxinator/ClassFinder requires either composer/composer'. |
| 120 | - ' or an optimised autoloader(`composer dump-autoload -o`)'); |
|
| 120 | + ' or an optimised autoloader(`composer dump-autoload -o`)'); |
|
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | if (!in_array($namespace, self::$loadedNamespaces)) { |
| 47 | 47 | $map = self::getClassMap($namespace); |
| 48 | - array_walk($map, function ($filename, $className, $namespace) { |
|
| 48 | + array_walk($map, function($filename, $className, $namespace) { |
|
| 49 | 49 | assert(file_exists($filename), $filename); |
| 50 | 50 | self::strStartsWith($namespace, $className) && class_exists($className, true); |
| 51 | 51 | }, $namespace); |
@@ -68,10 +68,9 @@ discard block |
||
| 68 | 68 | self::checkState(); |
| 69 | 69 | |
| 70 | 70 | return null !== (self::$optimisedClassMap) ? |
| 71 | - self::$optimisedClassMap : |
|
| 72 | - array_reduce( |
|
| 71 | + self::$optimisedClassMap : array_reduce( |
|
| 73 | 72 | self::getProjectSearchDirs($namespace), |
| 74 | - function ($map, $dir) { |
|
| 73 | + function($map, $dir) { |
|
| 75 | 74 | // Use composer's ClassMapGenerator to pull the class list out of each project search directory |
| 76 | 75 | return array_merge($map, ClassMapGenerator::createMap($dir)); |
| 77 | 76 | }, |
@@ -103,8 +102,7 @@ discard block |
||
| 103 | 102 | private static function getVendorDir(): string |
| 104 | 103 | { |
| 105 | 104 | return empty(self::$vendorDir) ? |
| 106 | - self::$vendorDir = dirname((new ReflectionClass(ClassLoader::class))->getFileName(), 2) : |
|
| 107 | - self::$vendorDir; |
|
| 105 | + self::$vendorDir = dirname((new ReflectionClass(ClassLoader::class))->getFileName(), 2) : self::$vendorDir; |
|
| 108 | 106 | } |
| 109 | 107 | |
| 110 | 108 | /** |
@@ -116,7 +114,7 @@ discard block |
||
| 116 | 114 | { |
| 117 | 115 | self::initClassMap(); |
| 118 | 116 | if (null === self::$optimisedClassMap && !class_exists(ClassMapGenerator::class)) { |
| 119 | - throw new Exception('Cruxinator/ClassFinder requires either composer/composer'. |
|
| 117 | + throw new Exception('Cruxinator/ClassFinder requires either composer/composer' . |
|
| 120 | 118 | ' or an optimised autoloader(`composer dump-autoload -o`)'); |
| 121 | 119 | } |
| 122 | 120 | } |
@@ -146,7 +144,7 @@ discard block |
||
| 146 | 144 | */ |
| 147 | 145 | private static function getComposerAutoloader(): ClassLoader |
| 148 | 146 | { |
| 149 | - return include self::getVendorDir().DIRECTORY_SEPARATOR.'autoload.php'; |
|
| 147 | + return include self::getVendorDir() . DIRECTORY_SEPARATOR . 'autoload.php'; |
|
| 150 | 148 | } |
| 151 | 149 | |
| 152 | 150 | /** |
@@ -163,7 +161,7 @@ discard block |
||
| 163 | 161 | public static function getClasses(string $namespace = '', callable $conditional = null, bool $includeVendor = true): array |
| 164 | 162 | { |
| 165 | 163 | $conditional = $conditional ?: 'is_string'; |
| 166 | - $classes = array_filter(self::getProjectClasses($namespace), function (string $class) use ( |
|
| 164 | + $classes = array_filter(self::getProjectClasses($namespace), function(string $class) use ( |
|
| 167 | 165 | $namespace, |
| 168 | 166 | $conditional, |
| 169 | 167 | $includeVendor |
@@ -196,7 +194,7 @@ discard block |
||
| 196 | 194 | { |
| 197 | 195 | $namespaceParts = explode('\\', $namespace); |
| 198 | 196 | while (!array_key_exists($namespace, $psr4) && count($namespaceParts) !== 0) { |
| 199 | - $namespace = implode('\\', $namespaceParts).'\\'; |
|
| 197 | + $namespace = implode('\\', $namespaceParts) . '\\'; |
|
| 200 | 198 | array_pop($namespaceParts); |
| 201 | 199 | } |
| 202 | 200 | |