| @@ -24,6 +24,6 @@ | ||
| 24 | 24 |      { | 
| 25 | 25 | $string = parent::__toString(); | 
| 26 | 26 | |
| 27 | - return $string . $this->postBody; | |
| 27 | + return $string.$this->postBody; | |
| 28 | 28 | } | 
| 29 | 29 | } | 
| @@ -30,7 +30,7 @@ | ||
| 30 | 30 | /** @var ResourceObject $ro */ | 
| 31 | 31 | $ro = $invocation->proceed(); | 
| 32 | 32 | $isCreated = $ro->code === 201 && isset($ro->headers['Location']); | 
| 33 | -        if (! $isCreated) { | |
| 33 | +        if (!$isCreated) { | |
| 34 | 34 | return $ro; | 
| 35 | 35 | } | 
| 36 | 36 | $ro->setRenderer($this->renderer); | 
| @@ -59,6 +59,9 @@ | ||
| 59 | 59 | } | 
| 60 | 60 | } | 
| 61 | 61 | |
| 62 | + /** | |
| 63 | + * @param string $method | |
| 64 | + */ | |
| 62 | 65 | private function isMagicMethod($method) : bool | 
| 63 | 66 |      { | 
| 64 | 67 | return \in_array($method, ['__sleep', '__wakeup', 'offsetGet', 'offsetSet', 'offsetExists', 'offsetUnset', 'count', 'ksort', 'asort', 'jsonSerialize'], true); | 
| @@ -42,7 +42,7 @@ discard block | ||
| 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 | ||
| 57 | 57 |          foreach ($appMeta->getResourceListGenerator() as [$className]) { | 
| 58 | 58 | $this->scanClass($injector, $reader, $namedParams, (string) $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 | ||
| 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,15 +82,15 @@ discard block | ||
| 82 | 82 | ); | 
| 83 | 83 | |
| 84 | 84 | $this->invokeTypicalRequest($appName, $context); | 
| 85 | - $fies = '<?php' . PHP_EOL; | |
| 85 | + $fies = '<?php'.PHP_EOL; | |
| 86 | 86 |          foreach ($this->classes as $class) { | 
| 87 | 87 | // could be phpdoc tag by annotation loader | 
| 88 | - $isAutoloadFailed = ! class_exists($class, false) && ! interface_exists($class, false) && ! trait_exists($class, false); | |
| 88 | + $isAutoloadFailed = !class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false); | |
| 89 | 89 |              if ($isAutoloadFailed) { | 
| 90 | 90 | continue; | 
| 91 | 91 | } | 
| 92 | 92 | $filePath = (string) (new ReflectionClass($class))->getFileName(); | 
| 93 | -            if (! file_exists($filePath) || strpos($filePath, 'phar') === 0) { | |
| 93 | +            if (!file_exists($filePath) || strpos($filePath, 'phar') === 0) { | |
| 94 | 94 | continue; | 
| 95 | 95 | } | 
| 96 | 96 | $fies .= sprintf( | 
| @@ -98,8 +98,8 @@ discard block | ||
| 98 | 98 | $this->getRelativePath($appDir, $filePath) | 
| 99 | 99 | ); | 
| 100 | 100 | } | 
| 101 | - $fies .= "require __DIR__ . '/vendor/autoload.php';" . PHP_EOL; | |
| 102 | - $loaderFile = realpath($appDir) . '/autoload.php'; | |
| 101 | + $fies .= "require __DIR__ . '/vendor/autoload.php';".PHP_EOL; | |
| 102 | + $loaderFile = realpath($appDir).'/autoload.php'; | |
| 103 | 103 | file_put_contents($loaderFile, $fies); | 
| 104 | 104 | |
| 105 | 105 | return $loaderFile; | 
| @@ -109,10 +109,10 @@ discard block | ||
| 109 | 109 |      { | 
| 110 | 110 | $dir = (string) realpath($rootDir); | 
| 111 | 111 |          if (strpos($file, $dir) !== false) { | 
| 112 | -            return (string) preg_replace('#^' . preg_quote($dir, '#') . '#', "__DIR__ . '", $file); | |
| 112 | +            return (string) preg_replace('#^'.preg_quote($dir, '#').'#', "__DIR__ . '", $file); | |
| 113 | 113 | } | 
| 114 | 114 | |
| 115 | - return "'" . $file; | |
| 115 | + return "'".$file; | |
| 116 | 116 | } | 
| 117 | 117 | |
| 118 | 118 | private function invokeTypicalRequest(string $appName, string $context) : void | 
| @@ -154,11 +154,11 @@ discard block | ||
| 154 | 154 | private function saveNamedParam(NamedParameterInterface $namedParameter, $instance, string $method) : void | 
| 155 | 155 |      { | 
| 156 | 156 | // named parameter | 
| 157 | -        if (! \in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) { | |
| 157 | +        if (!\in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) { | |
| 158 | 158 | return; | 
| 159 | 159 | } | 
| 160 | 160 | $callable = [$instance, $method]; | 
| 161 | -        if (! is_callable($callable)) { | |
| 161 | +        if (!is_callable($callable)) { | |
| 162 | 162 | return; | 
| 163 | 163 | } | 
| 164 | 164 |          try { | 
| @@ -30,7 +30,7 @@ | ||
| 30 | 30 | protected function configure() | 
| 31 | 31 |      { | 
| 32 | 32 | $this->bind(AbstractAppMeta::class)->toInstance($this->appMeta); | 
| 33 | - $this->bind(AppInterface::class)->to($this->appMeta->name . '\Module\App'); | |
| 33 | + $this->bind(AppInterface::class)->to($this->appMeta->name.'\Module\App'); | |
| 34 | 34 | $this->bind()->annotatedWith(AppName::class)->toInstance($this->appMeta->name); | 
| 35 | 35 | } | 
| 36 | 36 | } | 
| @@ -18,7 +18,7 @@ | ||
| 18 | 18 | |
| 19 | 19 | public function __construct(\Exception $e) | 
| 20 | 20 |      { | 
| 21 | -        $this->ref = hash('crc32b', \get_class($e) . $e->getMessage() . $e->getFile() . $e->getLine()); | |
| 21 | +        $this->ref = hash('crc32b', \get_class($e).$e->getMessage().$e->getFile().$e->getLine()); | |
| 22 | 22 | } | 
| 23 | 23 | |
| 24 | 24 | public function __toString() | 
| @@ -30,7 +30,7 @@ | ||
| 30 | 30 | */ | 
| 31 | 31 | public function __construct(AbstractAppMeta $appMeta, string $namespace) | 
| 32 | 32 |      { | 
| 33 | - $this->cacheDir = $appMeta->tmpDir . '/cache'; | |
| 33 | + $this->cacheDir = $appMeta->tmpDir.'/cache'; | |
| 34 | 34 | $this->namespace = $namespace; | 
| 35 | 35 | } | 
| 36 | 36 | |
| @@ -21,7 +21,7 @@ | ||
| 21 | 21 | |
| 22 | 22 | public function toString() | 
| 23 | 23 |      { | 
| 24 | - $this->view = json_encode($this->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . PHP_EOL; | |
| 24 | + $this->view = json_encode($this->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES).PHP_EOL; | |
| 25 | 25 | |
| 26 | 26 | return $this->view; | 
| 27 | 27 | } | 
| @@ -21,7 +21,7 @@ | ||
| 21 | 21 | |
| 22 | 22 | public function toString() | 
| 23 | 23 |      { | 
| 24 | - $this->view = json_encode($this->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . PHP_EOL; | |
| 24 | + $this->view = json_encode($this->body, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES).PHP_EOL; | |
| 25 | 25 | |
| 26 | 26 | return $this->view; | 
| 27 | 27 | } | 
| @@ -33,7 +33,7 @@ | ||
| 33 | 33 |      { | 
| 34 | 34 |          foreach ($this->routers as $route) { | 
| 35 | 35 | $match = $route->match($globals, $server); | 
| 36 | -            if ($match instanceof RouterMatch && ! ($match instanceof NullMatch)) { | |
| 36 | +            if ($match instanceof RouterMatch && !($match instanceof NullMatch)) { | |
| 37 | 37 | return $match; | 
| 38 | 38 | } | 
| 39 | 39 | } |