Completed
Push — cleanup ( 4198cf...e2cb58 )
by Akihito
04:45
created
src/Unlink.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@
 block discarded – undo
22 22
 
23 23
     public function __invoke(string $path) : void
24 24
     {
25
-        if ($this->isOptional && file_exists($path . '/.do_not_clear')) {
25
+        if ($this->isOptional && file_exists($path.'/.do_not_clear')) {
26 26
             return;
27 27
         }
28
-        foreach ((array) glob(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '*') as $file) {
28
+        foreach ((array) glob(rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'*') as $file) {
29 29
             is_dir((string) $file) ? $this->__invoke((string) $file) : unlink((string) $file);
30 30
             @rmdir((string) $file);
31 31
         }
Please login to merge, or discard this patch.
src/Compiler.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -44,20 +44,20 @@  discard block
 block discarded – undo
44 44
         $autoload = $this->compileAutoload($appName, $context, $appDir);
45 45
         $preload = $this->compilePreload($appDir);
46 46
         $log = $this->compileDiScripts($appName, $context, $appDir);
47
-        $this->ns = (string) filemtime(realpath($appDir) . '/src');
47
+        $this->ns = (string) filemtime(realpath($appDir).'/src');
48 48
 
49 49
         return sprintf("Compile Log: %s\nautoload.php: %s\npreload.php: %s", $log, $autoload, $preload);
50 50
     }
51 51
 
52 52
     public function registerLoader(string $appDir) : void
53 53
     {
54
-        $loaderFile = $appDir . '/vendor/autoload.php';
55
-        if (! file_exists($loaderFile)) {
54
+        $loaderFile = $appDir.'/vendor/autoload.php';
55
+        if (!file_exists($loaderFile)) {
56 56
             throw new \RuntimeException('no loader');
57 57
         }
58 58
         $loaderFile = require $loaderFile;
59 59
         spl_autoload_register(
60
-            function ($class) use ($loaderFile) : void {
60
+            function($class) use ($loaderFile) : void {
61 61
                 $loaderFile->loadClass($class);
62 62
                 if ($class !== NullPage::class) {
63 63
                     $this->classes[] = $class;
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         foreach ($appMeta->getResourceListGenerator() as [$className]) {
86 86
             $this->scanClass($injector, $reader, $namedParams, (string) $className);
87 87
         }
88
-        $logFile = realpath($appMeta->logDir) . '/compile.log';
88
+        $logFile = realpath($appMeta->logDir).'/compile.log';
89 89
         $this->saveCompileLog($appMeta, $context, $logFile);
90 90
 
91 91
         return $logFile;
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
 
102 102
     private function dumpAutoload(string $appDir, array $paths) : string
103 103
     {
104
-        $autoloadFile = '<?php' . PHP_EOL;
104
+        $autoloadFile = '<?php'.PHP_EOL;
105 105
         foreach ($paths as $path) {
106 106
             $autoloadFile .= sprintf(
107 107
                 "require %s';\n",
108 108
                 $this->getRelativePath($appDir, $path)
109 109
             );
110 110
         }
111
-        $autoloadFile .= "require __DIR__ . '/vendor/autoload.php';" . PHP_EOL;
112
-        $loaderFile = realpath($appDir) . '/autoload.php';
111
+        $autoloadFile .= "require __DIR__ . '/vendor/autoload.php';".PHP_EOL;
112
+        $loaderFile = realpath($appDir).'/autoload.php';
113 113
         file_put_contents($loaderFile, $autoloadFile);
114 114
 
115 115
         return $loaderFile;
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
     private function compilePreload(string $appDir) : string
119 119
     {
120 120
         $paths = $this->getPaths($this->classes, $appDir);
121
-        $output = '<?php' . PHP_EOL;
122
-        $output .= "opcache_compile_file(__DIR__ . '/vendor/autoload.php');" . PHP_EOL;
121
+        $output = '<?php'.PHP_EOL;
122
+        $output .= "opcache_compile_file(__DIR__ . '/vendor/autoload.php');".PHP_EOL;
123 123
         foreach ($paths as $path) {
124 124
             $output .= sprintf(
125 125
                 "opcache_compile_file(%s');\n",
126 126
                 $this->getRelativePath($appDir, $path)
127 127
             );
128 128
         }
129
-        $preloadFile = realpath($appDir) . '/preload.php';
129
+        $preloadFile = realpath($appDir).'/preload.php';
130 130
         file_put_contents($preloadFile, $output);
131 131
 
132 132
         return $preloadFile;
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     {
137 137
         $dir = (string) realpath($rootDir);
138 138
         if (strpos($file, $dir) !== false) {
139
-            return (string) preg_replace('#^' . preg_quote($dir, '#') . '#', "__DIR__ . '", $file);
139
+            return (string) preg_replace('#^'.preg_quote($dir, '#').'#', "__DIR__ . '", $file);
140 140
         }
141 141
 
142 142
         return $file;
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
     private function saveNamedParam(NamedParameterInterface $namedParameter, object $instance, string $method) : void
183 183
     {
184 184
         // named parameter
185
-        if (! \in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) {
185
+        if (!\in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) {
186 186
             return;
187 187
         }
188 188
         $callable = [$instance, $method];
189
-        if (! is_callable($callable)) {
189
+        if (!is_callable($callable)) {
190 190
             return;
191 191
         }
192 192
         try {
@@ -212,12 +212,12 @@  discard block
 block discarded – undo
212 212
         $paths = [];
213 213
         foreach ($classes as $class) {
214 214
             // could be phpdoc tag by annotation loader
215
-            $isAutoloadFailed = ! class_exists($class, false) && ! interface_exists($class, false) && ! trait_exists($class, false);
215
+            $isAutoloadFailed = !class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false);
216 216
             if ($isAutoloadFailed) {
217 217
                 continue;
218 218
             }
219 219
             $filePath = (string) (new ReflectionClass($class))->getFileName();
220
-            if (! file_exists($filePath) || strpos($filePath, 'phar') === 0) {
220
+            if (!file_exists($filePath) || strpos($filePath, 'phar') === 0) {
221 221
                 continue;
222 222
             }
223 223
             $paths[] = $this->getRelativePath($appDir, $filePath);
Please login to merge, or discard this patch.
src/Provide/Logger/MonologProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
     public function get() : Logger
29 29
     {
30 30
         $format = "[%datetime%] %level_name%: %message% %context%\n";
31
-        $stream = new StreamHandler($this->appMeta->logDir . '/app.log', Logger::DEBUG);
31
+        $stream = new StreamHandler($this->appMeta->logDir.'/app.log', Logger::DEBUG);
32 32
         $stream->setFormatter(new LineFormatter($format));
33 33
 
34 34
         return new Logger($this->appMeta->name, [$stream]);
Please login to merge, or discard this patch.
src/Provide/Router/HttpMethodParams.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     private function getParams(string $method, array $server, array $post) : array
88 88
     {
89 89
         // post data exists
90
-        if ($method === 'post' && ! empty($post)) {
90
+        if ($method === 'post' && !empty($post)) {
91 91
             return $post;
92 92
         }
93 93
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             return $put;
112 112
         }
113 113
         $isApplicationJson = strpos($contentType, self::APPLICATION_JSON) !== false;
114
-        if (! $isApplicationJson) {
114
+        if (!$isApplicationJson) {
115 115
             return [];
116 116
         }
117 117
         $content = json_decode($this->getRawBody($server), true);
Please login to merge, or discard this patch.
src/AppInjector.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
         $this->context = $context;
57 57
         $this->appMeta = $appMeta instanceof AbstractAppMeta ? $appMeta : new Meta($name, $context);
58 58
         $this->cacheNamespace = (string) $cacheNamespace;
59
-        $scriptDir = $this->appMeta->tmpDir . '/di';
60
-        ! is_dir($scriptDir) && ! mkdir($scriptDir) && ! is_dir($scriptDir);
59
+        $scriptDir = $this->appMeta->tmpDir.'/di';
60
+        !is_dir($scriptDir) && !mkdir($scriptDir) && !is_dir($scriptDir);
61 61
         $this->scriptDir = $scriptDir;
62
-        $appDir = $this->appMeta->tmpDir . '/app';
63
-        ! is_dir($appDir) && ! mkdir($appDir) && ! is_dir($appDir);
64
-        touch($appDir . '/.do_not_clear');
62
+        $appDir = $this->appMeta->tmpDir.'/app';
63
+        !is_dir($appDir) && !mkdir($appDir) && !is_dir($appDir);
64
+        touch($appDir.'/.do_not_clear');
65 65
         $this->appDir = $appDir;
66
-        $this->injector = new ScriptInjector($this->scriptDir, function () {
66
+        $this->injector = new ScriptInjector($this->scriptDir, function() {
67 67
             return $this->getModule();
68 68
         });
69 69
         if ($cacheNamespace === null) {
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
         if ((new Unlink)->once($this->appMeta->tmpDir)) {
101 101
             return;
102 102
         }
103
-        $diDir = $this->appMeta->tmpDir . '/di';
104
-        ! is_dir($diDir) && ! mkdir($diDir) && ! is_dir($diDir);
105
-        file_put_contents($this->scriptDir . ScriptInjector::MODULE, serialize($this->getModule()));
103
+        $diDir = $this->appMeta->tmpDir.'/di';
104
+        !is_dir($diDir) && !mkdir($diDir) && !is_dir($diDir);
105
+        file_put_contents($this->scriptDir.ScriptInjector::MODULE, serialize($this->getModule()));
106 106
     }
107 107
 
108 108
     /**
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     public function getCachedInstance(string $interface, string $name = Name::ANY)
112 112
     {
113 113
         $cache = new FilesystemCache($this->appDir);
114
-        $id = $interface . $name . $this->context . $this->cacheNamespace;
114
+        $id = $interface.$name.$this->context.$this->cacheNamespace;
115 115
         $instance = $cache->fetch($id);
116 116
         if ($instance) {
117 117
             return $instance;
Please login to merge, or discard this patch.