Completed
Push — preload ( ae9e48...9bee4e )
by Akihito
02:02
created
src/Compiler.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
 
48 48
     public function registerLoader(string $appDir) : void
49 49
     {
50
-        $loaderFile = $appDir . '/vendor/autoload.php';
51
-        if (! file_exists($loaderFile)) {
50
+        $loaderFile = $appDir.'/vendor/autoload.php';
51
+        if (!file_exists($loaderFile)) {
52 52
             throw new \RuntimeException('no loader');
53 53
         }
54 54
         $loaderFile = require $loaderFile;
55 55
         spl_autoload_register(
56
-            function ($class) use ($loaderFile) {
56
+            function($class) use ($loaderFile) {
57 57
                 $loaderFile->loadClass($class);
58 58
                 if ($class !== NullPage::class) {
59 59
                     $this->classes[] = $class;
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         foreach ($appMeta->getResourceListGenerator() as [$className]) {
82 82
             $this->scanClass($injector, $reader, $namedParams, (string) $className);
83 83
         }
84
-        $logFile = realpath($appMeta->logDir) . '/compile.log';
84
+        $logFile = realpath($appMeta->logDir).'/compile.log';
85 85
         $this->saveCompileLog($appMeta, $context, $logFile);
86 86
 
87 87
         return $logFile;
@@ -97,15 +97,15 @@  discard block
 block discarded – undo
97 97
 
98 98
     private function dumpAutoload(string $appDir, array $paths) : string
99 99
     {
100
-        $autoloadFile = '<?php' . PHP_EOL;
100
+        $autoloadFile = '<?php'.PHP_EOL;
101 101
         foreach ($paths as $path) {
102 102
             $autoloadFile .= sprintf(
103 103
                 "require %s';\n",
104 104
                 $this->getRelativePath($appDir, $path)
105 105
             );
106 106
         }
107
-        $autoloadFile .= "require __DIR__ . '/vendor/autoload.php';" . PHP_EOL;
108
-        $loaderFile = realpath($appDir) . '/autoload.php';
107
+        $autoloadFile .= "require __DIR__ . '/vendor/autoload.php';".PHP_EOL;
108
+        $loaderFile = realpath($appDir).'/autoload.php';
109 109
         file_put_contents($loaderFile, $autoloadFile);
110 110
 
111 111
         return $loaderFile;
@@ -115,20 +115,20 @@  discard block
 block discarded – undo
115 115
     {
116 116
         $this->loadResources($appName, $context, $appDir);
117 117
         $paths = $this->getPaths($this->classes, $appDir);
118
-        $output = '<?php' . PHP_EOL;
119
-        $output .= "require __DIR__ . '/vendor/autoload.php';" . PHP_EOL;
118
+        $output = '<?php'.PHP_EOL;
119
+        $output .= "require __DIR__ . '/vendor/autoload.php';".PHP_EOL;
120 120
         foreach ($paths as $path) {
121 121
             $output .= sprintf(
122 122
                 "require_once %s';\n",
123 123
                 $this->getRelativePath($appDir, $path)
124 124
             );
125 125
         }
126
-        $autoLoadFilesPath = $appDir . '/vendor/composer/autoload_files.php';
126
+        $autoLoadFilesPath = $appDir.'/vendor/composer/autoload_files.php';
127 127
         assert(file_exists($autoLoadFilesPath));
128 128
         $output = $this->appendIncludedFiles($appDir, require $autoLoadFilesPath, $output);
129
-        $diFiles = (array) glob($appDir . "/var/tmp/{$context}/di/*.php");
129
+        $diFiles = (array) glob($appDir."/var/tmp/{$context}/di/*.php");
130 130
         $output = $this->appendIncludedFiles($appDir, $diFiles, $output);
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
 block discarded – undo
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;
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
     private function saveNamedParam(NamedParameterInterface $namedParameter, $instance, string $method) : void
184 184
     {
185 185
         // named parameter
186
-        if (! \in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) {
186
+        if (!\in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) {
187 187
             return;
188 188
         }
189 189
         $callable = [$instance, $method];
190
-        if (! is_callable($callable)) {
190
+        if (!is_callable($callable)) {
191 191
             return;
192 192
         }
193 193
         try {
@@ -213,12 +213,12 @@  discard block
 block discarded – undo
213 213
         $paths = [];
214 214
         foreach ($classes as $class) {
215 215
             // could be phpdoc tag by annotation loader
216
-            $isAutoloadFailed = ! class_exists($class, false) && ! interface_exists($class, false) && ! trait_exists($class, false);
216
+            $isAutoloadFailed = !class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false);
217 217
             if ($isAutoloadFailed) {
218 218
                 continue;
219 219
             }
220 220
             $filePath = (string) (new ReflectionClass($class))->getFileName();
221
-            if (! file_exists($filePath) || strpos($filePath, 'phar') === 0) {
221
+            if (!file_exists($filePath) || strpos($filePath, 'phar') === 0) {
222 222
                 continue;
223 223
             }
224 224
             $paths[] = $this->getRelativePath($appDir, $filePath);
Please login to merge, or discard this patch.