@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * the vendor name, for example (Vendor\PackageName\Folder\Class). |
40 | 40 | * @return string|null The detected class name, or NULL otherwise. |
41 | 41 | */ |
42 | - public static function resolveClassName(string $legacyName, string $nsPrefix='') : ?string |
|
42 | + public static function resolveClassName(string $legacyName, string $nsPrefix = '') : ?string |
|
43 | 43 | { |
44 | 44 | $names = array( |
45 | 45 | str_replace('\\', '_', $legacyName), |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $nsPrefix.'\\'.str_replace('_', '\\', $legacyName) |
48 | 48 | ); |
49 | 49 | |
50 | - foreach($names as $name) { |
|
50 | + foreach ($names as $name) { |
|
51 | 51 | if (class_exists($name)) { |
52 | 52 | return ltrim($name, '\\'); |
53 | 53 | } |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | * @return string |
67 | 67 | * @throws ClassNotExistsException |
68 | 68 | */ |
69 | - public static function requireResolvedClass(string $legacyName, string $nsPrefix='') : string |
|
69 | + public static function requireResolvedClass(string $legacyName, string $nsPrefix = '') : string |
|
70 | 70 | { |
71 | 71 | $class = self::resolveClassName($legacyName, $nsPrefix); |
72 | 72 | |
73 | - if($class !== null) |
|
73 | + if ($class !== null) |
|
74 | 74 | { |
75 | 75 | return $class; |
76 | 76 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public static function requireClassExists(string $className) : void |
92 | 92 | { |
93 | - if(class_exists($className)) |
|
93 | + if (class_exists($className)) |
|
94 | 94 | { |
95 | 95 | return; |
96 | 96 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | self::requireClassExists($targetClass); |
116 | 116 | self::requireClassExists($extendsClass); |
117 | 117 | |
118 | - if(is_a($targetClass, $extendsClass, true)) |
|
118 | + if (is_a($targetClass, $extendsClass, true)) |
|
119 | 119 | { |
120 | 120 | return; |
121 | 121 | } |
@@ -136,14 +136,14 @@ discard block |
||
136 | 136 | * @throws ClassNotExistsException |
137 | 137 | * @throws ClassNotImplementsException |
138 | 138 | */ |
139 | - public static function requireObjectInstanceOf(string $class, object $object, int $errorCode=0) |
|
139 | + public static function requireObjectInstanceOf(string $class, object $object, int $errorCode = 0) |
|
140 | 140 | { |
141 | - if(!class_exists($class) && !interface_exists($class) && !trait_exists($class)) |
|
141 | + if (!class_exists($class) && !interface_exists($class) && !trait_exists($class)) |
|
142 | 142 | { |
143 | 143 | throw new ClassNotExistsException($class, $errorCode); |
144 | 144 | } |
145 | 145 | |
146 | - if(is_a($object, $class, true)) |
|
146 | + if (is_a($object, $class, true)) |
|
147 | 147 | { |
148 | 148 | return $object; |
149 | 149 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public static function getClassLoader() : ClassLoader |
166 | 166 | { |
167 | - if(isset(self::$classLoader)) { |
|
167 | + if (isset(self::$classLoader)) { |
|
168 | 168 | return self::$classLoader; |
169 | 169 | } |
170 | 170 | |
@@ -178,14 +178,14 @@ discard block |
||
178 | 178 | |
179 | 179 | $autoloadFile = null; |
180 | 180 | |
181 | - foreach($paths as $path) |
|
181 | + foreach ($paths as $path) |
|
182 | 182 | { |
183 | - if(file_exists($path)) { |
|
183 | + if (file_exists($path)) { |
|
184 | 184 | $autoloadFile = $path; |
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
188 | - if($autoloadFile === null) { |
|
188 | + if ($autoloadFile === null) { |
|
189 | 189 | throw new ClassLoaderNotFoundException($paths); |
190 | 190 | } |
191 | 191 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | */ |
237 | 237 | private static function splitClass($subject) : array |
238 | 238 | { |
239 | - if(is_object($subject)) { |
|
239 | + if (is_object($subject)) { |
|
240 | 240 | $class = get_class($subject); |
241 | 241 | } else { |
242 | 242 | $class = $subject; |