Completed
Push — preload ( 05d45b...2e1a83 )
by Akihito
02:58 queued 01:20
created
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()
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/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)
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/Bootstrap.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@
 block discarded – undo
30 30
 
31 31
     public function newApp(AbstractAppMeta $appMeta, string $contexts, Cache $cache = null, string $cacheNamespace = null) : AbstractApp
32 32
     {
33
-        $cacheNamespace = is_string($cacheNamespace) ? $cacheNamespace : (string) filemtime($appMeta->appDir . '/src');
33
+        $cacheNamespace = is_string($cacheNamespace) ? $cacheNamespace : (string) filemtime($appMeta->appDir.'/src');
34 34
         $injector = new AppInjector($appMeta->name, $contexts, $appMeta, $cacheNamespace);
35 35
         $cache = $cache instanceof Cache ? $cache : $injector->getCachedInstance(Cache::class);
36
-        $appId = $appMeta->name . $contexts . $cacheNamespace;
36
+        $appId = $appMeta->name.$contexts.$cacheNamespace;
37 37
         $app = $cache->fetch($appId);
38 38
         if ($app instanceof AbstractApp) {
39 39
             return $app;
Please login to merge, or discard this patch.
src/Module.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,17 +20,17 @@
 block discarded – undo
20 20
         $contextsArray = array_reverse(explode('-', $context));
21 21
         $module = new NullModule;
22 22
         foreach ($contextsArray as $contextItem) {
23
-            $class = $appMeta->name . '\Module\\' . ucwords($contextItem) . 'Module';
24
-            if (! class_exists($class)) {
25
-                $class = 'BEAR\Package\Context\\' . ucwords($contextItem) . 'Module';
23
+            $class = $appMeta->name.'\Module\\'.ucwords($contextItem).'Module';
24
+            if (!class_exists($class)) {
25
+                $class = 'BEAR\Package\Context\\'.ucwords($contextItem).'Module';
26 26
             }
27
-            if (! is_a($class, AbstractModule::class, true)) {
27
+            if (!is_a($class, AbstractModule::class, true)) {
28 28
                 throw new InvalidContextException($contextItem);
29 29
             }
30 30
             /* @var $module AbstractModule */
31 31
             $module = is_subclass_of($class, AbstractAppModule::class) ? new $class($appMeta, $module) : new $class($module);
32 32
         }
33
-        if (! $module instanceof AbstractModule) {
33
+        if (!$module instanceof AbstractModule) {
34 34
             throw new InvalidModuleException; // @codeCoverageIgnore
35 35
         }
36 36
         $module->override(new AppMetaModule($appMeta));
Please login to merge, or discard this patch.
src/Provide/Router/WebRouter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
     {
37 37
         $request = new RouterMatch;
38 38
         [$request->method, $request->query] = $this->httpMethodParams->get($server, $globals['_GET'], $globals['_POST']);
39
-        $request->path = $this->schemeHost . parse_url($server['REQUEST_URI'], PHP_URL_PATH);
39
+        $request->path = $this->schemeHost.parse_url($server['REQUEST_URI'], PHP_URL_PATH);
40 40
 
41 41
         return $request;
42 42
     }
Please login to merge, or discard this patch.
src/Provide/Transfer/CliResponder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@
 block discarded – undo
39 39
         $output = $isModified ? $this->getOutput($ro, $server) : $this->condResponse->getOutput($ro->headers);
40 40
 
41 41
         $statusText = (new Code)->statusText[$ro->code] ?? '';
42
-        $ob = $output->code . ' ' . $statusText . PHP_EOL;
42
+        $ob = $output->code.' '.$statusText.PHP_EOL;
43 43
 
44 44
         // header
45 45
         foreach ($output->headers as $label => $value) {
46
-            $ob .= "{$label}: {$value}" . PHP_EOL;
46
+            $ob .= "{$label}: {$value}".PHP_EOL;
47 47
         }
48 48
 
49 49
         // empty line
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) {
@@ -92,15 +92,15 @@  discard block
 block discarded – undo
92 92
         if ((new Unlink)->once($this->appMeta->tmpDir)) {
93 93
             return;
94 94
         }
95
-        $diDir = $this->appMeta->tmpDir . '/di';
96
-        ! is_dir($diDir) && ! mkdir($diDir) && ! is_dir($diDir);
97
-        file_put_contents($this->scriptDir . ScriptInjector::MODULE, serialize($this->getModule()));
95
+        $diDir = $this->appMeta->tmpDir.'/di';
96
+        !is_dir($diDir) && !mkdir($diDir) && !is_dir($diDir);
97
+        file_put_contents($this->scriptDir.ScriptInjector::MODULE, serialize($this->getModule()));
98 98
     }
99 99
 
100 100
     public function getCachedInstance(string $interface, $name = Name::ANY)
101 101
     {
102 102
         $cache = new FilesystemCache($this->appDir);
103
-        $id = $interface . $name . $this->context . $this->cacheNamespace;
103
+        $id = $interface.$name.$this->context.$this->cacheNamespace;
104 104
         $instance = $cache->fetch($id);
105 105
         if ($instance) {
106 106
             return $instance;
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
@@ -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;
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     {
65 65
         $appMeta = new Meta($appName, $context, $appDir);
66 66
         (new Unlink)->force($appMeta->tmpDir);
67
-        $cacheNs = (string) filemtime($appMeta->appDir . '/src');
67
+        $cacheNs = (string) filemtime($appMeta->appDir.'/src');
68 68
         $injector = new AppInjector($appName, $context, $appMeta, $cacheNs);
69 69
         $cache = $injector->getInstance(Cache::class);
70 70
         $reader = $injector->getInstance(AnnotationReader::class);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         foreach ($appMeta->getResourceListGenerator() as [$className]) {
80 80
             $this->scanClass($injector, $reader, $namedParams, (string) $className);
81 81
         }
82
-        $logFile = realpath($appMeta->logDir) . '/compile.log';
82
+        $logFile = realpath($appMeta->logDir).'/compile.log';
83 83
         $this->saveCompileLog($appMeta, $context, $logFile);
84 84
 
85 85
         return $logFile;
@@ -95,15 +95,15 @@  discard block
 block discarded – undo
95 95
 
96 96
     private function dumpAutoload(string $appDir, array $paths) : string
97 97
     {
98
-        $autoloadFile = '<?php' . PHP_EOL;
98
+        $autoloadFile = '<?php'.PHP_EOL;
99 99
         foreach ($paths as $path) {
100 100
             $autoloadFile .= sprintf(
101 101
                 "require %s';\n",
102 102
                 $this->getRelativePath($appDir, $path)
103 103
             );
104 104
         }
105
-        $autoloadFile .= "require __DIR__ . '/vendor/autoload.php';" . PHP_EOL;
106
-        $loaderFile = realpath($appDir) . '/autoload.php';
105
+        $autoloadFile .= "require __DIR__ . '/vendor/autoload.php';".PHP_EOL;
106
+        $loaderFile = realpath($appDir).'/autoload.php';
107 107
         file_put_contents($loaderFile, $autoloadFile);
108 108
 
109 109
         return $loaderFile;
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
     {
114 114
         $this->loadResources($appName, $context, $appDir);
115 115
         $paths = $this->getPaths($this->classes, $appDir);
116
-        $output = '<?php' . PHP_EOL;
117
-        $output .= "require __DIR__ . '/vendor/autoload.php';" . PHP_EOL;
116
+        $output = '<?php'.PHP_EOL;
117
+        $output .= "require __DIR__ . '/vendor/autoload.php';".PHP_EOL;
118 118
         foreach ($paths as $path) {
119 119
             $output .= sprintf(
120 120
                 "require %s';\n",
121 121
                 $this->getRelativePath($appDir, $path)
122 122
             );
123 123
         }
124
-        $preloadFile = realpath($appDir) . '/preload.php';
124
+        $preloadFile = realpath($appDir).'/preload.php';
125 125
         file_put_contents($preloadFile, $output);
126 126
 
127 127
         return $preloadFile;
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     {
132 132
         $dir = (string) realpath($rootDir);
133 133
         if (strpos($file, $dir) !== false) {
134
-            return (string) preg_replace('#^' . preg_quote($dir, '#') . '#', "__DIR__ . '", $file);
134
+            return (string) preg_replace('#^'.preg_quote($dir, '#').'#', "__DIR__ . '", $file);
135 135
         }
136 136
 
137 137
         return $file;
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
     private function saveNamedParam(NamedParameterInterface $namedParameter, $instance, string $method) : void
178 178
     {
179 179
         // named parameter
180
-        if (! \in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) {
180
+        if (!\in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) {
181 181
             return;
182 182
         }
183 183
         $callable = [$instance, $method];
184
-        if (! is_callable($callable)) {
184
+        if (!is_callable($callable)) {
185 185
             return;
186 186
         }
187 187
         try {
@@ -207,12 +207,12 @@  discard block
 block discarded – undo
207 207
         $paths = [];
208 208
         foreach ($classes as $class) {
209 209
             // could be phpdoc tag by annotation loader
210
-            $isAutoloadFailed = ! class_exists($class, false) && ! interface_exists($class, false) && ! trait_exists($class, false);
210
+            $isAutoloadFailed = !class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false);
211 211
             if ($isAutoloadFailed) {
212 212
                 continue;
213 213
             }
214 214
             $filePath = (string) (new ReflectionClass($class))->getFileName();
215
-            if (! file_exists($filePath) || strpos($filePath, 'phar') === 0) {
215
+            if (!file_exists($filePath) || strpos($filePath, 'phar') === 0) {
216 216
                 continue;
217 217
             }
218 218
             $paths[] = $this->getRelativePath($appDir, $filePath);
Please login to merge, or discard this patch.