Completed
Pull Request — 1.x (#302)
by kazusuke
02:38
created
src/Compiler.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     {
43 43
         $appMeta = new AppMeta($appName, $context, $appDir);
44 44
         (new Unlink)->force($appMeta->tmpDir);
45
-        $cacheNs = (string) filemtime($appMeta->appDir . '/src');
45
+        $cacheNs = (string) filemtime($appMeta->appDir.'/src');
46 46
         $injector = new AppInjector($appName, $context, $appMeta, $cacheNs);
47 47
         $cache = $injector->getInstance(Cache::class);
48 48
         $reader = $injector->getInstance(AnnotationReader::class);
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         foreach ($appMeta->getResourceListGenerator() as list($className)) {
58 58
             $this->scanClass($injector, $reader, $namedParams, $className);
59 59
         }
60
-        $logFile = realpath($appMeta->logDir) . '/compile.log';
60
+        $logFile = realpath($appMeta->logDir).'/compile.log';
61 61
         $this->saveCompileLog($appMeta, $context, $logFile);
62 62
 
63 63
         return $logFile;
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
 
66 66
     private function compileLoader(string $appName, string $context, string $appDir) : string
67 67
     {
68
-        $loaderFile = $appDir . '/vendor/autoload.php';
69
-        if (! file_exists($loaderFile)) {
68
+        $loaderFile = $appDir.'/vendor/autoload.php';
69
+        if (!file_exists($loaderFile)) {
70 70
             return '';
71 71
         }
72 72
         $loaderFile = require $loaderFile;
73 73
         spl_autoload_register(
74
-            function ($class) use ($loaderFile) {
74
+            function($class) use ($loaderFile) {
75 75
                 $loaderFile->loadClass($class);
76 76
                 if ($class !== NullPage::class) {
77 77
                     $this->classes[] = $class;
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
         );
83 83
 
84 84
         $this->invokeTypicalRequest($appName, $context);
85
-        $fies = '<?php declare(strict_types=1);' . PHP_EOL;
85
+        $fies = '<?php declare(strict_types=1);'.PHP_EOL;
86 86
         foreach ($this->classes as $class) {
87
-            $isAutoloadFailed = ! class_exists($class, false) && ! interface_exists($class, false) && ! trait_exists($class, false); // could be phpdoc tag by anotation loader
87
+            $isAutoloadFailed = !class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false); // could be phpdoc tag by anotation loader
88 88
             if ($isAutoloadFailed) {
89 89
                 continue;
90 90
             }
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
                 $this->getRelativePath($appDir, (string) (new \ReflectionClass($class))->getFileName())
94 94
             );
95 95
         }
96
-        $fies .= "require __DIR__ . '/vendor/autoload.php';" . PHP_EOL;
97
-        $loaderFile = realpath($appDir) . '/autoload.php';
96
+        $fies .= "require __DIR__ . '/vendor/autoload.php';".PHP_EOL;
97
+        $loaderFile = realpath($appDir).'/autoload.php';
98 98
         file_put_contents($loaderFile, $fies);
99 99
 
100 100
         return $loaderFile;
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
     {
105 105
         $dir = (string) realpath($rootDir);
106 106
         if (strpos($file, $dir) !== false) {
107
-            return (string) preg_replace('#^' . preg_quote($dir, '#') . '#', "__DIR__ . '", $file);
107
+            return (string) preg_replace('#^'.preg_quote($dir, '#').'#', "__DIR__ . '", $file);
108 108
         }
109 109
 
110
-        return "'" . $file;
110
+        return "'".$file;
111 111
     }
112 112
 
113 113
     private function invokeTypicalRequest(string $appName, string $context)
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
     private function saveNamedParam(NamedParameterInterface $namedParameter, $instance, string $method) : void
150 150
     {
151 151
         // named parameter
152
-        if (! \in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) {
152
+        if (!\in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) {
153 153
             return;
154 154
         }
155 155
         $callable = [$instance, $method];
156
-        if (! is_callable($callable)) {
156
+        if (!is_callable($callable)) {
157 157
             return;
158 158
         }
159 159
         try {
Please login to merge, or discard this patch.