@@ -45,20 +45,20 @@ discard block |
||
| 45 | 45 | $autoload = $this->compileAutoload($appName, $context, $appDir); |
| 46 | 46 | $preload = $this->compilePreload($appName, $context, $appDir); |
| 47 | 47 | $log = $this->compileDiScripts($appName, $context, $appDir); |
| 48 | - $this->ns = (string) filemtime(realpath($appDir) . '/src'); |
|
| 48 | + $this->ns = (string) filemtime(realpath($appDir).'/src'); |
|
| 49 | 49 | |
| 50 | 50 | return sprintf("Compile Log: %s\nautoload.php: %s\npreload.php: %s", $log, $autoload, $preload); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | public function registerLoader(string $appDir) : void |
| 54 | 54 | { |
| 55 | - $loaderFile = $appDir . '/vendor/autoload.php'; |
|
| 56 | - if (! file_exists($loaderFile)) { |
|
| 55 | + $loaderFile = $appDir.'/vendor/autoload.php'; |
|
| 56 | + if (!file_exists($loaderFile)) { |
|
| 57 | 57 | throw new \RuntimeException('no loader'); |
| 58 | 58 | } |
| 59 | 59 | $loaderFile = require $loaderFile; |
| 60 | 60 | spl_autoload_register( |
| 61 | - function ($class) use ($loaderFile) { |
|
| 61 | + function($class) use ($loaderFile) { |
|
| 62 | 62 | $loaderFile->loadClass($class); |
| 63 | 63 | if ($class !== NullPage::class) { |
| 64 | 64 | $this->classes[] = $class; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | foreach ($appMeta->getResourceListGenerator() as [$className]) { |
| 87 | 87 | $this->scanClass($injector, $reader, $namedParams, (string) $className); |
| 88 | 88 | } |
| 89 | - $logFile = realpath($appMeta->logDir) . '/compile.log'; |
|
| 89 | + $logFile = realpath($appMeta->logDir).'/compile.log'; |
|
| 90 | 90 | $this->saveCompileLog($appMeta, $context, $logFile); |
| 91 | 91 | |
| 92 | 92 | return $logFile; |
@@ -102,15 +102,15 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | private function dumpAutoload(string $appDir, array $paths) : string |
| 104 | 104 | { |
| 105 | - $autoloadFile = '<?php' . PHP_EOL; |
|
| 105 | + $autoloadFile = '<?php'.PHP_EOL; |
|
| 106 | 106 | foreach ($paths as $path) { |
| 107 | 107 | $autoloadFile .= sprintf( |
| 108 | 108 | "require %s';\n", |
| 109 | 109 | $this->getRelativePath($appDir, $path) |
| 110 | 110 | ); |
| 111 | 111 | } |
| 112 | - $autoloadFile .= "require __DIR__ . '/vendor/autoload.php';" . PHP_EOL; |
|
| 113 | - $loaderFile = realpath($appDir) . '/autoload.php'; |
|
| 112 | + $autoloadFile .= "require __DIR__ . '/vendor/autoload.php';".PHP_EOL; |
|
| 113 | + $loaderFile = realpath($appDir).'/autoload.php'; |
|
| 114 | 114 | file_put_contents($loaderFile, $autoloadFile); |
| 115 | 115 | |
| 116 | 116 | return $loaderFile; |
@@ -120,15 +120,15 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | //$this->loadResources($appName, $context, $appDir); |
| 122 | 122 | $paths = $this->getPaths($this->classes, $appDir); |
| 123 | - $output = '<?php' . PHP_EOL; |
|
| 124 | - $output .= "opcache_compile_file(__DIR__ . '/vendor/autoload.php');" . PHP_EOL; |
|
| 123 | + $output = '<?php'.PHP_EOL; |
|
| 124 | + $output .= "opcache_compile_file(__DIR__ . '/vendor/autoload.php');".PHP_EOL; |
|
| 125 | 125 | foreach ($paths as $path) { |
| 126 | 126 | $output .= sprintf( |
| 127 | 127 | "opcache_compile_file(%s');\n", |
| 128 | 128 | $this->getRelativePath($appDir, $path) |
| 129 | 129 | ); |
| 130 | 130 | } |
| 131 | - $preloadFile = realpath($appDir) . '/preload.php'; |
|
| 131 | + $preloadFile = realpath($appDir).'/preload.php'; |
|
| 132 | 132 | file_put_contents($preloadFile, $output); |
| 133 | 133 | |
| 134 | 134 | return $preloadFile; |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | { |
| 139 | 139 | $dir = (string) realpath($rootDir); |
| 140 | 140 | if (strpos($file, $dir) !== false) { |
| 141 | - return (string) preg_replace('#^' . preg_quote($dir, '#') . '#', "__DIR__ . '", $file); |
|
| 141 | + return (string) preg_replace('#^'.preg_quote($dir, '#').'#', "__DIR__ . '", $file); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | return $file; |
@@ -184,11 +184,11 @@ discard block |
||
| 184 | 184 | private function saveNamedParam(NamedParameterInterface $namedParameter, $instance, string $method) : void |
| 185 | 185 | { |
| 186 | 186 | // named parameter |
| 187 | - if (! \in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) { |
|
| 187 | + if (!\in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) { |
|
| 188 | 188 | return; |
| 189 | 189 | } |
| 190 | 190 | $callable = [$instance, $method]; |
| 191 | - if (! is_callable($callable)) { |
|
| 191 | + if (!is_callable($callable)) { |
|
| 192 | 192 | return; |
| 193 | 193 | } |
| 194 | 194 | try { |
@@ -214,12 +214,12 @@ discard block |
||
| 214 | 214 | $paths = []; |
| 215 | 215 | foreach ($classes as $class) { |
| 216 | 216 | // could be phpdoc tag by annotation loader |
| 217 | - $isAutoloadFailed = ! class_exists($class, false) && ! interface_exists($class, false) && ! trait_exists($class, false); |
|
| 217 | + $isAutoloadFailed = !class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false); |
|
| 218 | 218 | if ($isAutoloadFailed) { |
| 219 | 219 | continue; |
| 220 | 220 | } |
| 221 | 221 | $filePath = (string) (new ReflectionClass($class))->getFileName(); |
| 222 | - if (! file_exists($filePath) || strpos($filePath, 'phar') === 0) { |
|
| 222 | + if (!file_exists($filePath) || strpos($filePath, 'phar') === 0) { |
|
| 223 | 223 | continue; |
| 224 | 224 | } |
| 225 | 225 | $paths[] = $this->getRelativePath($appDir, $filePath); |