@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function compile() : int |
| 97 | 97 | { |
| 98 | - if (! is_dir($this->appDir)) { |
|
| 98 | + if (!is_dir($this->appDir)) { |
|
| 99 | 99 | throw new RuntimeException($this->appDir); |
| 100 | 100 | } |
| 101 | 101 | $preload = $this->compilePreload($this->appMeta, $this->context); |
@@ -136,15 +136,15 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | public function registerLoader(string $appDir) : void |
| 138 | 138 | { |
| 139 | - $loaderFile = $appDir . '/vendor/autoload.php'; |
|
| 140 | - if (! file_exists($loaderFile)) { |
|
| 139 | + $loaderFile = $appDir.'/vendor/autoload.php'; |
|
| 140 | + if (!file_exists($loaderFile)) { |
|
| 141 | 141 | throw new RuntimeException('no loader'); |
| 142 | 142 | } |
| 143 | 143 | /** @var ClassLoader $loader */ |
| 144 | 144 | $loader = require $loaderFile; |
| 145 | 145 | spl_autoload_register( |
| 146 | 146 | /** @var class-string $class */ |
| 147 | - function (string $class) use ($loader) : void { |
|
| 147 | + function(string $class) use ($loader) : void { |
|
| 148 | 148 | $loader->loadClass($class); |
| 149 | 149 | if ($class !== NullPage::class) { |
| 150 | 150 | $this->classes[] = $class; |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | */ |
| 198 | 198 | private function saveAutoloadFile(string $appDir, array $paths) : string |
| 199 | 199 | { |
| 200 | - $autoloadFile = '<?php' . PHP_EOL . 'require __DIR__ . \'/vendor/ray/di/src/ProviderInterface.php\'; |
|
| 200 | + $autoloadFile = '<?php'.PHP_EOL.'require __DIR__ . \'/vendor/ray/di/src/ProviderInterface.php\'; |
|
| 201 | 201 | ' . PHP_EOL; |
| 202 | 202 | foreach ($paths as $path) { |
| 203 | 203 | $autoloadFile .= sprintf( |
@@ -205,8 +205,8 @@ discard block |
||
| 205 | 205 | $this->getRelativePath($appDir, $path) |
| 206 | 206 | ); |
| 207 | 207 | } |
| 208 | - $autoloadFile .= "require __DIR__ . '/vendor/autoload.php';" . PHP_EOL; |
|
| 209 | - $loaderFile = realpath($appDir) . '/autoload.php'; |
|
| 208 | + $autoloadFile .= "require __DIR__ . '/vendor/autoload.php';".PHP_EOL; |
|
| 209 | + $loaderFile = realpath($appDir).'/autoload.php'; |
|
| 210 | 210 | file_put_contents($loaderFile, $autoloadFile); |
| 211 | 211 | |
| 212 | 212 | return $loaderFile; |
@@ -216,15 +216,15 @@ discard block |
||
| 216 | 216 | { |
| 217 | 217 | $this->loadResources($appMeta->name, $context, $appMeta->appDir); |
| 218 | 218 | $paths = $this->getPaths($this->classes); |
| 219 | - $output = '<?php' . PHP_EOL; |
|
| 220 | - $output .= "require __DIR__ . '/vendor/autoload.php';" . PHP_EOL; |
|
| 219 | + $output = '<?php'.PHP_EOL; |
|
| 220 | + $output .= "require __DIR__ . '/vendor/autoload.php';".PHP_EOL; |
|
| 221 | 221 | foreach ($paths as $path) { |
| 222 | 222 | $output .= sprintf( |
| 223 | 223 | "require_once %s';\n", |
| 224 | 224 | $this->getRelativePath($appMeta->appDir, $path) |
| 225 | 225 | ); |
| 226 | 226 | } |
| 227 | - $preloadFile = realpath($appMeta->appDir) . '/preload.php'; |
|
| 227 | + $preloadFile = realpath($appMeta->appDir).'/preload.php'; |
|
| 228 | 228 | file_put_contents($preloadFile, $output); |
| 229 | 229 | |
| 230 | 230 | return $preloadFile; |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | { |
| 235 | 235 | $dir = (string) realpath($rootDir); |
| 236 | 236 | if (strpos($file, $dir) !== false) { |
| 237 | - return (string) preg_replace('#^' . preg_quote($dir, '#') . '#', "__DIR__ . '", $file); |
|
| 237 | + return (string) preg_replace('#^'.preg_quote($dir, '#').'#', "__DIR__ . '", $file); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | return $file; |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | $class = new ReflectionClass($className); |
| 267 | 267 | /** @var T $instance */ |
| 268 | 268 | $instance = $class->newInstanceWithoutConstructor(); |
| 269 | - if (! $instance instanceof $className) { |
|
| 269 | + if (!$instance instanceof $className) { |
|
| 270 | 270 | return; |
| 271 | 271 | } |
| 272 | 272 | $reader->getClassAnnotations($class); |
@@ -296,11 +296,11 @@ discard block |
||
| 296 | 296 | private function saveNamedParam(NamedParameterInterface $namedParameter, object $instance, string $method) : void |
| 297 | 297 | { |
| 298 | 298 | // named parameter |
| 299 | - if (! \in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) { |
|
| 299 | + if (!\in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) { |
|
| 300 | 300 | return; |
| 301 | 301 | } |
| 302 | 302 | $callable = [$instance, $method]; |
| 303 | - if (! is_callable($callable)) { |
|
| 303 | + if (!is_callable($callable)) { |
|
| 304 | 304 | return; |
| 305 | 305 | } |
| 306 | 306 | try { |
@@ -320,13 +320,13 @@ discard block |
||
| 320 | 320 | $paths = []; |
| 321 | 321 | foreach ($classes as $class) { |
| 322 | 322 | // could be phpdoc tag by annotation loader |
| 323 | - $isAutoloadFailed = ! class_exists($class, false) && ! interface_exists($class, false) && ! trait_exists($class, false); |
|
| 323 | + $isAutoloadFailed = !class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false); |
|
| 324 | 324 | if ($isAutoloadFailed) { |
| 325 | 325 | continue; |
| 326 | 326 | } |
| 327 | 327 | assert(class_exists($class) || interface_exists($class) || trait_exists($class)); |
| 328 | 328 | $filePath = (string) (new ReflectionClass($class))->getFileName(); |
| 329 | - if (! file_exists($filePath) || strpos($filePath, 'phar') === 0) { |
|
| 329 | + if (!file_exists($filePath) || strpos($filePath, 'phar') === 0) { |
|
| 330 | 330 | continue; |
| 331 | 331 | } |
| 332 | 332 | $paths[] = $this->getRelativePath($this->appDir, $filePath); |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | |
| 347 | 347 | private function getInstance(string $interface, string $name = '') : void |
| 348 | 348 | { |
| 349 | - $dependencyIndex = $interface . '-' . $name; |
|
| 349 | + $dependencyIndex = $interface.'-'.$name; |
|
| 350 | 350 | if (in_array($dependencyIndex, $this->compiled, true)) { |
| 351 | 351 | printf("S %s:%s\n", $interface, $name); |
| 352 | 352 | |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | |
| 386 | 386 | private function hookNullObjectClass(string $appDir) : void |
| 387 | 387 | { |
| 388 | - $compileScript = realpath($appDir) . '/.compile.php'; |
|
| 388 | + $compileScript = realpath($appDir).'/.compile.php'; |
|
| 389 | 389 | if (file_exists($compileScript)) { |
| 390 | 390 | require $compileScript; |
| 391 | 391 | } |