@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | |
44 | 44 | public function registerLoader(string $appDir) : void |
45 | 45 | { |
46 | - $loaderFile = $appDir . '/vendor/autoload.php'; |
|
47 | - if (! file_exists($loaderFile)) { |
|
46 | + $loaderFile = $appDir.'/vendor/autoload.php'; |
|
47 | + if (!file_exists($loaderFile)) { |
|
48 | 48 | throw new \RuntimeException('no loader'); |
49 | 49 | } |
50 | 50 | $loaderFile = require $loaderFile; |
51 | 51 | spl_autoload_register( |
52 | - function ($class) use ($loaderFile) { |
|
52 | + function($class) use ($loaderFile) { |
|
53 | 53 | $loaderFile->loadClass($class); |
54 | 54 | if ($class !== NullPage::class) { |
55 | 55 | $this->classes[] = $class; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | { |
65 | 65 | $appMeta = new Meta($appName, $context, $appDir); |
66 | 66 | (new Unlink)->force($appMeta->tmpDir); |
67 | - $cacheNs = (string) filemtime($appMeta->appDir . '/src'); |
|
67 | + $cacheNs = (string) filemtime($appMeta->appDir.'/src'); |
|
68 | 68 | $injector = new AppInjector($appName, $context, $appMeta, $cacheNs); |
69 | 69 | $cache = $injector->getInstance(Cache::class); |
70 | 70 | $reader = $injector->getInstance(AnnotationReader::class); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | foreach ($appMeta->getResourceListGenerator() as [$className]) { |
80 | 80 | $this->scanClass($injector, $reader, $namedParams, (string) $className); |
81 | 81 | } |
82 | - $logFile = realpath($appMeta->logDir) . '/compile.log'; |
|
82 | + $logFile = realpath($appMeta->logDir).'/compile.log'; |
|
83 | 83 | $this->saveCompileLog($appMeta, $context, $logFile); |
84 | 84 | |
85 | 85 | return $logFile; |
@@ -95,15 +95,15 @@ discard block |
||
95 | 95 | |
96 | 96 | private function dumpAutoload(string $appDir, array $paths) : string |
97 | 97 | { |
98 | - $autoloadFile = '<?php' . PHP_EOL; |
|
98 | + $autoloadFile = '<?php'.PHP_EOL; |
|
99 | 99 | foreach ($paths as $path) { |
100 | 100 | $autoloadFile .= sprintf( |
101 | 101 | "require %s';\n", |
102 | 102 | $this->getRelativePath($appDir, $path) |
103 | 103 | ); |
104 | 104 | } |
105 | - $autoloadFile .= "require __DIR__ . '/vendor/autoload.php';" . PHP_EOL; |
|
106 | - $loaderFile = realpath($appDir) . '/autoload.php'; |
|
105 | + $autoloadFile .= "require __DIR__ . '/vendor/autoload.php';".PHP_EOL; |
|
106 | + $loaderFile = realpath($appDir).'/autoload.php'; |
|
107 | 107 | file_put_contents($loaderFile, $autoloadFile); |
108 | 108 | |
109 | 109 | return $loaderFile; |
@@ -113,15 +113,15 @@ discard block |
||
113 | 113 | { |
114 | 114 | $this->loadResources($appName, $context, $appDir); |
115 | 115 | $paths = $this->getPaths($this->classes, $appDir); |
116 | - $output = '<?php' . PHP_EOL; |
|
117 | - $output .= "require __DIR__ . '/vendor/autoload.php';" . PHP_EOL; |
|
116 | + $output = '<?php'.PHP_EOL; |
|
117 | + $output .= "require __DIR__ . '/vendor/autoload.php';".PHP_EOL; |
|
118 | 118 | foreach ($paths as $path) { |
119 | 119 | $output .= sprintf( |
120 | 120 | "require %s';\n", |
121 | 121 | $this->getRelativePath($appDir, $path) |
122 | 122 | ); |
123 | 123 | } |
124 | - $preloadFile = realpath($appDir) . '/preload.php'; |
|
124 | + $preloadFile = realpath($appDir).'/preload.php'; |
|
125 | 125 | file_put_contents($preloadFile, $output); |
126 | 126 | |
127 | 127 | return $preloadFile; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | { |
132 | 132 | $dir = (string) realpath($rootDir); |
133 | 133 | if (strpos($file, $dir) !== false) { |
134 | - return (string) preg_replace('#^' . preg_quote($dir, '#') . '#', "__DIR__ . '", $file); |
|
134 | + return (string) preg_replace('#^'.preg_quote($dir, '#').'#', "__DIR__ . '", $file); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | return $file; |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | private function saveNamedParam(NamedParameterInterface $namedParameter, $instance, string $method) : void |
178 | 178 | { |
179 | 179 | // named parameter |
180 | - if (! \in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) { |
|
180 | + if (!\in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) { |
|
181 | 181 | return; |
182 | 182 | } |
183 | 183 | $callable = [$instance, $method]; |
184 | - if (! is_callable($callable)) { |
|
184 | + if (!is_callable($callable)) { |
|
185 | 185 | return; |
186 | 186 | } |
187 | 187 | try { |
@@ -207,12 +207,12 @@ discard block |
||
207 | 207 | $paths = []; |
208 | 208 | foreach ($classes as $class) { |
209 | 209 | // could be phpdoc tag by annotation loader |
210 | - $isAutoloadFailed = ! class_exists($class, false) && ! interface_exists($class, false) && ! trait_exists($class, false); |
|
210 | + $isAutoloadFailed = !class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false); |
|
211 | 211 | if ($isAutoloadFailed) { |
212 | 212 | continue; |
213 | 213 | } |
214 | 214 | $filePath = (string) (new ReflectionClass($class))->getFileName(); |
215 | - if (! file_exists($filePath) || strpos($filePath, 'phar') === 0) { |
|
215 | + if (!file_exists($filePath) || strpos($filePath, 'phar') === 0) { |
|
216 | 216 | continue; |
217 | 217 | } |
218 | 218 | $paths[] = $this->getRelativePath($appDir, $filePath); |