Completed
Push — preload ( 2e1a83...ae9e48 )
by Akihito
02:25
created
src/Compiler.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -43,13 +43,13 @@  discard block
 block discarded – undo
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;
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         foreach ($appMeta->getResourceListGenerator() as [$className]) {
78 78
             $this->scanClass($injector, $reader, $namedParams, (string) $className);
79 79
         }
80
-        $logFile = realpath($appMeta->logDir) . '/compile.log';
80
+        $logFile = realpath($appMeta->logDir).'/compile.log';
81 81
         $this->saveCompileLog($appMeta, $context, $logFile);
82 82
 
83 83
         return $logFile;
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
 
94 94
     private function dumpAutoload(string $appDir, array $paths) : string
95 95
     {
96
-        $autoloadFile = '<?php' . PHP_EOL;
96
+        $autoloadFile = '<?php'.PHP_EOL;
97 97
         foreach ($paths as $path) {
98 98
             $autoloadFile .= sprintf(
99 99
                 "require %s';\n",
100 100
                 $this->getRelativePath($appDir, $path)
101 101
             );
102 102
         }
103
-        $autoloadFile .= "require __DIR__ . '/vendor/autoload.php';" . PHP_EOL;
104
-        $loaderFile = realpath($appDir) . '/autoload.php';
103
+        $autoloadFile .= "require __DIR__ . '/vendor/autoload.php';".PHP_EOL;
104
+        $loaderFile = realpath($appDir).'/autoload.php';
105 105
         file_put_contents($loaderFile, $autoloadFile);
106 106
 
107 107
         return $loaderFile;
@@ -111,15 +111,15 @@  discard block
 block discarded – undo
111 111
     {
112 112
         $this->loadResources($appName, $context, $appDir);
113 113
         $paths = $this->getPaths($this->classes, $appDir);
114
-        $output = '<?php' . PHP_EOL;
115
-        $output .= "require __DIR__ . '/vendor/autoload.php';" . PHP_EOL;
114
+        $output = '<?php'.PHP_EOL;
115
+        $output .= "require __DIR__ . '/vendor/autoload.php';".PHP_EOL;
116 116
         foreach ($paths as $path) {
117 117
             $output .= sprintf(
118 118
                 "require %s';\n",
119 119
                 $this->getRelativePath($appDir, $path)
120 120
             );
121 121
         }
122
-        $preloadFile = realpath($appDir) . '/preload.php';
122
+        $preloadFile = realpath($appDir).'/preload.php';
123 123
         file_put_contents($preloadFile, $output);
124 124
 
125 125
         return $preloadFile;
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     {
130 130
         $dir = (string) realpath($rootDir);
131 131
         if (strpos($file, $dir) !== false) {
132
-            return (string) preg_replace('#^' . preg_quote($dir, '#') . '#', "__DIR__ . '", $file);
132
+            return (string) preg_replace('#^'.preg_quote($dir, '#').'#', "__DIR__ . '", $file);
133 133
         }
134 134
 
135 135
         return $file;
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
     private function saveNamedParam(NamedParameterInterface $namedParameter, $instance, string $method) : void
176 176
     {
177 177
         // named parameter
178
-        if (! \in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) {
178
+        if (!\in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) {
179 179
             return;
180 180
         }
181 181
         $callable = [$instance, $method];
182
-        if (! is_callable($callable)) {
182
+        if (!is_callable($callable)) {
183 183
             return;
184 184
         }
185 185
         try {
@@ -205,12 +205,12 @@  discard block
 block discarded – undo
205 205
         $paths = [];
206 206
         foreach ($classes as $class) {
207 207
             // could be phpdoc tag by annotation loader
208
-            $isAutoloadFailed = ! class_exists($class, false) && ! interface_exists($class, false) && ! trait_exists($class, false);
208
+            $isAutoloadFailed = !class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false);
209 209
             if ($isAutoloadFailed) {
210 210
                 continue;
211 211
             }
212 212
             $filePath = (string) (new ReflectionClass($class))->getFileName();
213
-            if (! file_exists($filePath) || strpos($filePath, 'phar') === 0) {
213
+            if (!file_exists($filePath) || strpos($filePath, 'phar') === 0) {
214 214
                 continue;
215 215
             }
216 216
             $paths[] = $this->getRelativePath($appDir, $filePath);
Please login to merge, or discard this patch.