Completed
Push — spike ( 0ccb53...1e2394 )
by Akihito
02:42
created
src/Module.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,17 +21,17 @@
 block discarded – undo
21 21
         $contextsArray = array_reverse(explode('-', $context));
22 22
         $module = new AssistedModule;
23 23
         foreach ($contextsArray as $contextItem) {
24
-            $class = $appMeta->name . '\Module\\' . ucwords($contextItem) . 'Module';
25
-            if (! class_exists($class)) {
26
-                $class = 'BEAR\Package\Context\\' . ucwords($contextItem) . 'Module';
24
+            $class = $appMeta->name.'\Module\\'.ucwords($contextItem).'Module';
25
+            if (!class_exists($class)) {
26
+                $class = 'BEAR\Package\Context\\'.ucwords($contextItem).'Module';
27 27
             }
28
-            if (! is_a($class, AbstractModule::class, true)) {
28
+            if (!is_a($class, AbstractModule::class, true)) {
29 29
                 throw new InvalidContextException($contextItem);
30 30
             }
31 31
             /* @var $module AbstractModule */
32 32
             $module = is_subclass_of($class, AbstractAppModule::class) ? new $class($appMeta, $module) : new $class($module);
33 33
         }
34
-        if (! $module instanceof AbstractModule) {
34
+        if (!$module instanceof AbstractModule) {
35 35
             throw new InvalidModuleException; // @codeCoverageIgnore
36 36
         }
37 37
         $module->override(new AppMetaModule($appMeta));
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) : 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/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/Compiler.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function __invoke(string $appName, string $context, string $appDir) : string
42 42
     {
43
-        $this->ns = (string) filemtime(realpath($appDir) . '/src');
43
+        $this->ns = (string) filemtime(realpath($appDir).'/src');
44 44
         $this->registerLoader($appDir);
45 45
         $appMeta = new Meta($appName, $context, $appDir);
46 46
         $autoload = $this->compileAutoload($appMeta, $context);
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         $module = (new Module)($appMeta, $context);
49 49
         $this->compileSrc($module, $appMeta, $context);
50 50
         $this->compileDiScripts($appMeta, $context);
51
-        $logFile = realpath($appMeta->logDir) . '/compile.log';
51
+        $logFile = realpath($appMeta->logDir).'/compile.log';
52 52
         file_put_contents($logFile, (string) $module);
53 53
 
54 54
         return sprintf("Compile Log: %s\nautoload.php: %s\npreload.php: %s", $logFile, $autoload, $preload);
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 
57 57
     public function registerLoader(string $appDir) : void
58 58
     {
59
-        $loaderFile = $appDir . '/vendor/autoload.php';
60
-        if (! file_exists($loaderFile)) {
59
+        $loaderFile = $appDir.'/vendor/autoload.php';
60
+        if (!file_exists($loaderFile)) {
61 61
             throw new \RuntimeException('no loader');
62 62
         }
63 63
         $loaderFile = require $loaderFile;
64 64
         spl_autoload_register(
65
-            function ($class) use ($loaderFile) : void {
65
+            function($class) use ($loaderFile) : void {
66 66
                 $loaderFile->loadClass($class);
67 67
                 if ($class !== NullPage::class) {
68 68
                     $this->classes[] = $class;
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 
119 119
     private function dumpAutoload(string $appDir, array $paths) : string
120 120
     {
121
-        $autoloadFile = '<?php' . PHP_EOL;
121
+        $autoloadFile = '<?php'.PHP_EOL;
122 122
         foreach ($paths as $path) {
123 123
             $autoloadFile .= sprintf(
124 124
                 "require %s';\n",
125 125
                 $this->getRelativePath($appDir, $path)
126 126
             );
127 127
         }
128
-        $autoloadFile .= "require __DIR__ . '/vendor/autoload.php';" . PHP_EOL;
129
-        $loaderFile = realpath($appDir) . '/autoload.php';
128
+        $autoloadFile .= "require __DIR__ . '/vendor/autoload.php';".PHP_EOL;
129
+        $loaderFile = realpath($appDir).'/autoload.php';
130 130
         file_put_contents($loaderFile, $autoloadFile);
131 131
 
132 132
         return $loaderFile;
@@ -136,15 +136,15 @@  discard block
 block discarded – undo
136 136
     {
137 137
         $this->loadResources($appMeta->name, $context, $appMeta->appDir);
138 138
         $paths = $this->getPaths($this->classes, $appMeta->appDir);
139
-        $output = '<?php' . PHP_EOL;
140
-        $output .= "require __DIR__ . '/vendor/autoload.php';" . PHP_EOL;
139
+        $output = '<?php'.PHP_EOL;
140
+        $output .= "require __DIR__ . '/vendor/autoload.php';".PHP_EOL;
141 141
         foreach ($paths as $path) {
142 142
             $output .= sprintf(
143 143
                 "require %s';\n",
144 144
                 $this->getRelativePath($appMeta->appDir, $path)
145 145
             );
146 146
         }
147
-        $preloadFile = realpath($appMeta->appDir) . '/preload.php';
147
+        $preloadFile = realpath($appMeta->appDir).'/preload.php';
148 148
         file_put_contents($preloadFile, $output);
149 149
 
150 150
         return $preloadFile;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     {
155 155
         $dir = (string) realpath($rootDir);
156 156
         if (strpos($file, $dir) !== false) {
157
-            return (string) preg_replace('#^' . preg_quote($dir, '#') . '#', "__DIR__ . '", $file);
157
+            return (string) preg_replace('#^'.preg_quote($dir, '#').'#', "__DIR__ . '", $file);
158 158
         }
159 159
 
160 160
         return $file;
@@ -200,11 +200,11 @@  discard block
 block discarded – undo
200 200
     private function saveNamedParam(NamedParameterInterface $namedParameter, object $instance, string $method) : void
201 201
     {
202 202
         // named parameter
203
-        if (! \in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) {
203
+        if (!\in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) {
204 204
             return;
205 205
         }
206 206
         $callable = [$instance, $method];
207
-        if (! is_callable($callable)) {
207
+        if (!is_callable($callable)) {
208 208
             return;
209 209
         }
210 210
         try {
@@ -219,12 +219,12 @@  discard block
 block discarded – undo
219 219
         $paths = [];
220 220
         foreach ($classes as $class) {
221 221
             // could be phpdoc tag by annotation loader
222
-            $isAutoloadFailed = ! class_exists($class, false) && ! interface_exists($class, false) && ! trait_exists($class, false);
222
+            $isAutoloadFailed = !class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false);
223 223
             if ($isAutoloadFailed) {
224 224
                 continue;
225 225
             }
226 226
             $filePath = (string) (new ReflectionClass($class))->getFileName();
227
-            if (! file_exists($filePath) || strpos($filePath, 'phar') === 0) {
227
+            if (!file_exists($filePath) || strpos($filePath, 'phar') === 0) {
228 228
                 continue;
229 229
             }
230 230
             $paths[] = $this->getRelativePath($appDir, $filePath);
Please login to merge, or discard this patch.
src/AppMetaModule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
     protected function configure() : void
30 30
     {
31 31
         $this->bind(AbstractAppMeta::class)->toInstance($this->appMeta);
32
-        $this->bind(AppInterface::class)->to($this->appMeta->name . '\Module\App')->in(Scope::SINGLETON);
32
+        $this->bind(AppInterface::class)->to($this->appMeta->name.'\Module\App')->in(Scope::SINGLETON);
33 33
         $this->bind()->annotatedWith(AppName::class)->toInstance($this->appMeta->name);
34 34
     }
35 35
 }
Please login to merge, or discard this patch.
src/Injector.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
     public static function getInstance(string $appName, string $context, string $appDir, string $cacheNamespace = '') : InjectorInterface
32 32
     {
33
-        $injectorId = $appName . $context . $cacheNamespace;
33
+        $injectorId = $appName.$context.$cacheNamespace;
34 34
         if (isset(self::$instances[$injectorId])) {
35 35
             return self::$instances[$injectorId];
36 36
         }
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 
46 46
     private static function factory(Meta $meta, string $context, string $cacheNamespace, ChainCache $cache) : InjectorInterface
47 47
     {
48
-        $scriptDir = $meta->tmpDir . '/di';
49
-        ! is_dir($scriptDir) && ! @mkdir($scriptDir) && ! is_dir($scriptDir);
48
+        $scriptDir = $meta->tmpDir.'/di';
49
+        !is_dir($scriptDir) && !@mkdir($scriptDir) && !is_dir($scriptDir);
50 50
         $module = (new Module)($meta, $context, $cacheNamespace);
51 51
         $rayInjector = new RayInjector($module, $scriptDir);
52 52
         $isDev = $rayInjector->getInstance(Cache::class) instanceof ArrayCache;
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
             return $rayInjector;
57 57
         }
58
-        $scriptInjector = new ScriptInjector($scriptDir, function () use ($scriptDir, $module) {
58
+        $scriptInjector = new ScriptInjector($scriptDir, function() use ($scriptDir, $module) {
59 59
             return new ScriptinjectorModule($scriptDir, $module);
60 60
         });
61 61
         $scriptInjector->getInstance(AppInterface::class); // cache App as a singleton
Please login to merge, or discard this patch.