@@ -45,20 +45,20 @@ discard block |
||
45 | 45 | $autoload = $this->compileAutoload($appName, $context, $appDir); |
46 | 46 | $log = $this->compileDiScripts($appName, $context, $appDir); |
47 | 47 | $preload = $this->compilePreload($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; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | foreach ($appMeta->getResourceListGenerator() as [$className]) { |
89 | 89 | $this->scanClass($injector, $reader, $namedParams, (string) $className); |
90 | 90 | } |
91 | - $logFile = realpath($appMeta->logDir) . '/compile.log'; |
|
91 | + $logFile = realpath($appMeta->logDir).'/compile.log'; |
|
92 | 92 | $this->saveCompileLog($appMeta, $context, $logFile); |
93 | 93 | |
94 | 94 | return $logFile; |
@@ -104,15 +104,15 @@ discard block |
||
104 | 104 | |
105 | 105 | private function dumpAutoload(string $appDir, array $paths) : string |
106 | 106 | { |
107 | - $autoloadFile = '<?php' . PHP_EOL; |
|
107 | + $autoloadFile = '<?php'.PHP_EOL; |
|
108 | 108 | foreach ($paths as $path) { |
109 | 109 | $autoloadFile .= sprintf( |
110 | 110 | "require %s';\n", |
111 | 111 | $this->getRelativePath($appDir, $path) |
112 | 112 | ); |
113 | 113 | } |
114 | - $autoloadFile .= "require __DIR__ . '/vendor/autoload.php';" . PHP_EOL; |
|
115 | - $loaderFile = realpath($appDir) . '/autoload.php'; |
|
114 | + $autoloadFile .= "require __DIR__ . '/vendor/autoload.php';".PHP_EOL; |
|
115 | + $loaderFile = realpath($appDir).'/autoload.php'; |
|
116 | 116 | file_put_contents($loaderFile, $autoloadFile); |
117 | 117 | |
118 | 118 | return $loaderFile; |
@@ -122,15 +122,15 @@ discard block |
||
122 | 122 | { |
123 | 123 | $this->loadResources($appName, $context, $appDir); |
124 | 124 | $paths = $this->getPaths($this->classes, $appDir); |
125 | - $output = '<?php' . PHP_EOL; |
|
126 | - $output .= "require __DIR__ . '/vendor/autoload.php';" . PHP_EOL; |
|
125 | + $output = '<?php'.PHP_EOL; |
|
126 | + $output .= "require __DIR__ . '/vendor/autoload.php';".PHP_EOL; |
|
127 | 127 | foreach ($paths as $path) { |
128 | 128 | $output .= sprintf( |
129 | 129 | "require %s';\n", |
130 | 130 | $this->getRelativePath($appDir, $path) |
131 | 131 | ); |
132 | 132 | } |
133 | - $preloadFile = realpath($appDir) . '/preload.php'; |
|
133 | + $preloadFile = realpath($appDir).'/preload.php'; |
|
134 | 134 | file_put_contents($preloadFile, $output); |
135 | 135 | |
136 | 136 | return $preloadFile; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | { |
141 | 141 | $dir = (string) realpath($rootDir); |
142 | 142 | if (strpos($file, $dir) !== false) { |
143 | - return (string) preg_replace('#^' . preg_quote($dir, '#') . '#', "__DIR__ . '", $file); |
|
143 | + return (string) preg_replace('#^'.preg_quote($dir, '#').'#', "__DIR__ . '", $file); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | return $file; |
@@ -186,11 +186,11 @@ discard block |
||
186 | 186 | private function saveNamedParam(NamedParameterInterface $namedParameter, $instance, string $method) : void |
187 | 187 | { |
188 | 188 | // named parameter |
189 | - if (! \in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) { |
|
189 | + if (!\in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) { |
|
190 | 190 | return; |
191 | 191 | } |
192 | 192 | $callable = [$instance, $method]; |
193 | - if (! is_callable($callable)) { |
|
193 | + if (!is_callable($callable)) { |
|
194 | 194 | return; |
195 | 195 | } |
196 | 196 | try { |
@@ -216,12 +216,12 @@ discard block |
||
216 | 216 | $paths = []; |
217 | 217 | foreach ($classes as $class) { |
218 | 218 | // could be phpdoc tag by annotation loader |
219 | - $isAutoloadFailed = ! class_exists($class, false) && ! interface_exists($class, false) && ! trait_exists($class, false); |
|
219 | + $isAutoloadFailed = !class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false); |
|
220 | 220 | if ($isAutoloadFailed) { |
221 | 221 | continue; |
222 | 222 | } |
223 | 223 | $filePath = (string) (new ReflectionClass($class))->getFileName(); |
224 | - if (! file_exists($filePath) || strpos($filePath, 'phar') === 0) { |
|
224 | + if (!file_exists($filePath) || strpos($filePath, 'phar') === 0) { |
|
225 | 225 | continue; |
226 | 226 | } |
227 | 227 | $paths[] = $this->getRelativePath($appDir, $filePath); |