| @@ -41,7 +41,7 @@ | ||
| 41 | 41 |      { | 
| 42 | 42 | $request = new RouterMatch; | 
| 43 | 43 | list($request->method, $request->query) = $this->httpMethodParams->get($server, $globals['_GET'], $globals['_POST']); | 
| 44 | - $request->path = $this->schemeHost . parse_url($server['REQUEST_URI'], PHP_URL_PATH); | |
| 44 | + $request->path = $this->schemeHost.parse_url($server['REQUEST_URI'], PHP_URL_PATH); | |
| 45 | 45 | |
| 46 | 46 | return $request; | 
| 47 | 47 | } | 
| @@ -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 | } | 
| @@ -23,7 +23,7 @@ | ||
| 23 | 23 | $this->rename(RouterInterface::class, 'original'); | 
| 24 | 24 | $this->bind(RouterInterface::class)->to(CliRouter::class); | 
| 25 | 25 | $this->bind(TransferInterface::class)->to(CliResponder::class); | 
| 26 | - $stdIn = tempnam(sys_get_temp_dir(), 'stdin-' . crc32(__FILE__)); | |
| 26 | + $stdIn = tempnam(sys_get_temp_dir(), 'stdin-'.crc32(__FILE__)); | |
| 27 | 27 | $this->bind()->annotatedWith(StdIn::class)->toInstance($stdIn); | 
| 28 | 28 | } | 
| 29 | 29 | } | 
| @@ -18,15 +18,15 @@ | ||
| 18 | 18 | public function __invoke(ResourceObject $resourceObject, array $server) | 
| 19 | 19 |      { | 
| 20 | 20 | unset($server); | 
| 21 | -        if (! $resourceObject->view) { | |
| 21 | +        if (!$resourceObject->view) { | |
| 22 | 22 | $resourceObject->toString(); | 
| 23 | 23 | } | 
| 24 | 24 | // code | 
| 25 | 25 | $statusText = (new Code)->statusText[$resourceObject->code]; | 
| 26 | - $ob = $resourceObject->code . ' ' . $statusText . PHP_EOL; | |
| 26 | + $ob = $resourceObject->code.' '.$statusText.PHP_EOL; | |
| 27 | 27 | // header | 
| 28 | 28 |          foreach ($resourceObject->headers as $label => $value) { | 
| 29 | -            $ob .= "{$label}: {$value}" . PHP_EOL; | |
| 29 | +            $ob .= "{$label}: {$value}".PHP_EOL; | |
| 30 | 30 | } | 
| 31 | 31 | // empty line | 
| 32 | 32 | $ob .= PHP_EOL; | 
| @@ -40,7 +40,7 @@ discard block | ||
| 40 | 40 | |
| 41 | 41 | public function addHalLink(array $body, array $methodAnnotations, Hal $hal) : Hal | 
| 42 | 42 |      { | 
| 43 | -        if (! empty($methodAnnotations)) { | |
| 43 | +        if (!empty($methodAnnotations)) { | |
| 44 | 44 | $hal = $this->linkAnnotation($body, $methodAnnotations, $hal); | 
| 45 | 45 | } | 
| 46 | 46 |          if (isset($body['_links'])) { | 
| @@ -53,7 +53,7 @@ discard block | ||
| 53 | 53 | private function linkAnnotation(array $body, array $methodAnnotations, Hal $hal) : Hal | 
| 54 | 54 |      { | 
| 55 | 55 |          foreach ($methodAnnotations as $annotation) { | 
| 56 | -            if (! $annotation instanceof Link) { | |
| 56 | +            if (!$annotation instanceof Link) { | |
| 57 | 57 | continue; | 
| 58 | 58 | } | 
| 59 | 59 | $uri = uri_template($annotation->href, $body); | 
| @@ -22,6 +22,9 @@ | ||
| 22 | 22 | $this->router = $router; | 
| 23 | 23 | } | 
| 24 | 24 | |
| 25 | + /** | |
| 26 | + * @param string $uri | |
| 27 | + */ | |
| 25 | 28 | public function getReverseLink($uri) : string | 
| 26 | 29 |      { | 
| 27 | 30 | $urlParts = parse_url($uri); | 
| @@ -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); | 
| @@ -45,7 +45,7 @@ discard block | ||
| 45 | 45 |      { | 
| 46 | 46 | $appMeta = new AppMeta($appName, $context, $appDir); | 
| 47 | 47 | (new Unlink)->force($appMeta->tmpDir); | 
| 48 | - $cacheNs = (string) filemtime($appMeta->appDir . '/src'); | |
| 48 | + $cacheNs = (string) filemtime($appMeta->appDir.'/src'); | |
| 49 | 49 | $injector = new AppInjector($appName, $context, $appMeta, $cacheNs); | 
| 50 | 50 | $cache = $injector->getInstance(Cache::class); | 
| 51 | 51 | $reader = $injector->getInstance(AnnotationReader::class); | 
| @@ -60,7 +60,7 @@ discard block | ||
| 60 | 60 |          foreach ($appMeta->getResourceListGenerator() as list($className)) { | 
| 61 | 61 | $this->scanClass($injector, $reader, $namedParams, $className); | 
| 62 | 62 | } | 
| 63 | - $logFile = realpath($appMeta->logDir) . '/compile.log'; | |
| 63 | + $logFile = realpath($appMeta->logDir).'/compile.log'; | |
| 64 | 64 | $this->saveCompileLog($appMeta, $context, $logFile); | 
| 65 | 65 | |
| 66 | 66 | return $logFile; | 
| @@ -68,13 +68,13 @@ discard block | ||
| 68 | 68 | |
| 69 | 69 | private function compileLoader(string $appName, string $context, string $appDir) : string | 
| 70 | 70 |      { | 
| 71 | - $loaderFile = $appDir . '/vendor/autoload.php'; | |
| 72 | -        if (! file_exists($loaderFile)) { | |
| 71 | + $loaderFile = $appDir.'/vendor/autoload.php'; | |
| 72 | +        if (!file_exists($loaderFile)) { | |
| 73 | 73 | return ''; | 
| 74 | 74 | } | 
| 75 | 75 | $loaderFile = require $loaderFile; | 
| 76 | 76 | spl_autoload_register( | 
| 77 | -            function ($class) use ($loaderFile) { | |
| 77 | +            function($class) use ($loaderFile) { | |
| 78 | 78 | $loaderFile->loadClass($class); | 
| 79 | 79 |                  if ($class !== NullPage::class) { | 
| 80 | 80 | $this->classes[] = $class; | 
| @@ -85,9 +85,9 @@ discard block | ||
| 85 | 85 | ); | 
| 86 | 86 | |
| 87 | 87 | $this->invokeTypicalReuqest($appName, $context); | 
| 88 | - $fies = '<?php' . PHP_EOL; | |
| 88 | + $fies = '<?php'.PHP_EOL; | |
| 89 | 89 |          foreach ($this->classes as $class) { | 
| 90 | - $isAutoloadFailed = ! class_exists($class, false) && ! interface_exists($class, false) && ! trait_exists($class, false); // could be phpdoc tag by anotation loader | |
| 90 | + $isAutoloadFailed = !class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false); // could be phpdoc tag by anotation loader | |
| 91 | 91 |              if ($isAutoloadFailed) { | 
| 92 | 92 | continue; | 
| 93 | 93 | } | 
| @@ -96,8 +96,8 @@ discard block | ||
| 96 | 96 | $this->getRelativePath($appDir, (new \ReflectionClass($class))->getFileName()) | 
| 97 | 97 | ); | 
| 98 | 98 | } | 
| 99 | - $fies .= "require __DIR__ . '/vendor/autoload.php';" . PHP_EOL; | |
| 100 | - $loaderFile = realpath($appDir) . '/autoload.php'; | |
| 99 | + $fies .= "require __DIR__ . '/vendor/autoload.php';".PHP_EOL; | |
| 100 | + $loaderFile = realpath($appDir).'/autoload.php'; | |
| 101 | 101 | file_put_contents($loaderFile, $fies); | 
| 102 | 102 | |
| 103 | 103 | return $loaderFile; | 
| @@ -110,7 +110,7 @@ discard block | ||
| 110 | 110 |              return str_replace("{$dir}", "__DIR__ . '", $file); | 
| 111 | 111 | } | 
| 112 | 112 | |
| 113 | - return "'" . $file; | |
| 113 | + return "'".$file; | |
| 114 | 114 | } | 
| 115 | 115 | |
| 116 | 116 | private function invokeTypicalReuqest(string $appName, string $context) | 
| @@ -152,7 +152,7 @@ discard block | ||
| 152 | 152 | private function saveNamedParam(NamedParameterInterface $namedParameter, $instance, string $method) | 
| 153 | 153 |      { | 
| 154 | 154 | // named parameter | 
| 155 | -        if (! \in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) { | |
| 155 | +        if (!\in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) { | |
| 156 | 156 | return; | 
| 157 | 157 | } | 
| 158 | 158 |          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 | } | 
| @@ -28,6 +28,6 @@ | ||
| 28 | 28 | */ | 
| 29 | 29 | public function get() | 
| 30 | 30 |      { | 
| 31 | - return new Logger($this->appMeta->name, [new StreamHandler($this->appMeta->logDir . '/app.log', Logger::DEBUG)]); | |
| 31 | + return new Logger($this->appMeta->name, [new StreamHandler($this->appMeta->logDir.'/app.log', Logger::DEBUG)]); | |
| 32 | 32 | } | 
| 33 | 33 | } |