@@ -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 | } |
@@ -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); |
@@ -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); |
@@ -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() |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | if ($ro->view) { |
| 44 | 44 | return $ro->view; |
| 45 | 45 | } |
| 46 | - $method = 'on' . ucfirst($ro->uri->method); |
|
| 46 | + $method = 'on'.ucfirst($ro->uri->method); |
|
| 47 | 47 | $annotations = $this->reader->getMethodAnnotations(new \ReflectionMethod($ro, $method)); |
| 48 | 48 | |
| 49 | 49 | return $this->renderHal($ro, $annotations); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | /* @var $annotations Link[] */ |
| 56 | 56 | /* @var $ro ResourceObject */ |
| 57 | 57 | $hal = $this->getHal($ro->uri, $body, $annotations); |
| 58 | - $ro->view = $hal->asJson(true) . PHP_EOL; |
|
| 58 | + $ro->view = $hal->asJson(true).PHP_EOL; |
|
| 59 | 59 | $this->updateHeaders($ro); |
| 60 | 60 | |
| 61 | 61 | return $ro->view; |
@@ -83,13 +83,13 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | private function isDifferentSchema(ResourceObject $parentRo, ResourceObject $childRo) : bool |
| 85 | 85 | { |
| 86 | - return $parentRo->uri->scheme . $parentRo->uri->host !== $childRo->uri->scheme . $childRo->uri->host; |
|
| 86 | + return $parentRo->uri->scheme.$parentRo->uri->host !== $childRo->uri->scheme.$childRo->uri->host; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | private function getHal(AbstractUri $uri, array $body, array $annotations) : Hal |
| 90 | 90 | { |
| 91 | - $query = $uri->query ? '?' . http_build_query($uri->query) : ''; |
|
| 92 | - $path = $uri->path . $query; |
|
| 91 | + $query = $uri->query ? '?'.http_build_query($uri->query) : ''; |
|
| 92 | + $path = $uri->path.$query; |
|
| 93 | 93 | $selfLink = $this->link->getReverseLink($path); |
| 94 | 94 | |
| 95 | 95 | $hal = new Hal($selfLink, $body); |
@@ -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 | |
@@ -54,17 +54,17 @@ discard block |
||
| 54 | 54 | $this->context = $context; |
| 55 | 55 | $this->appMeta = $appMeta instanceof AbstractAppMeta ? $appMeta : new Meta($name, $context); |
| 56 | 56 | $this->cacheSpace = $cacheSpace; |
| 57 | - $scriptDir = $this->appMeta->tmpDir . '/di'; |
|
| 58 | - ! \file_exists($scriptDir) && \mkdir($scriptDir); |
|
| 57 | + $scriptDir = $this->appMeta->tmpDir.'/di'; |
|
| 58 | + !\file_exists($scriptDir) && \mkdir($scriptDir); |
|
| 59 | 59 | $this->scriptDir = $scriptDir; |
| 60 | - $appDir = $this->appMeta->tmpDir . '/app'; |
|
| 61 | - ! \file_exists($appDir) && \mkdir($appDir); |
|
| 62 | - touch($appDir . '/.do_not_clear'); |
|
| 60 | + $appDir = $this->appMeta->tmpDir.'/app'; |
|
| 61 | + !\file_exists($appDir) && \mkdir($appDir); |
|
| 62 | + touch($appDir.'/.do_not_clear'); |
|
| 63 | 63 | $this->appDir = $appDir; |
| 64 | - $this->injector = new ScriptInjector($this->scriptDir, function () { |
|
| 64 | + $this->injector = new ScriptInjector($this->scriptDir, function() { |
|
| 65 | 65 | return $this->getModule(); |
| 66 | 66 | }); |
| 67 | - if (! $cacheSpace) { |
|
| 67 | + if (!$cacheSpace) { |
|
| 68 | 68 | $this->clear(); |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -90,16 +90,16 @@ discard block |
||
| 90 | 90 | if ((new Unlink)->once($this->appMeta->tmpDir)) { |
| 91 | 91 | return; |
| 92 | 92 | } |
| 93 | - ! is_dir($this->appMeta->tmpDir . '/di') && \mkdir($this->appMeta->tmpDir . '/di'); |
|
| 94 | - file_put_contents($this->scriptDir . ScriptInjector::MODULE, serialize($this->getModule())); |
|
| 93 | + !is_dir($this->appMeta->tmpDir.'/di') && \mkdir($this->appMeta->tmpDir.'/di'); |
|
| 94 | + file_put_contents($this->scriptDir.ScriptInjector::MODULE, serialize($this->getModule())); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | public function getCachedInstance($interface, $name = Name::ANY) |
| 98 | 98 | { |
| 99 | - $lockFile = $this->appMeta->appDir . '/composer.lock'; |
|
| 99 | + $lockFile = $this->appMeta->appDir.'/composer.lock'; |
|
| 100 | 100 | $this->cacheSpace .= file_exists($lockFile) ? (string) filemtime($lockFile) : ''; |
| 101 | 101 | $cache = new FilesystemCache($this->appDir); |
| 102 | - $id = $interface . $name . $this->context . $this->cacheSpace; |
|
| 102 | + $id = $interface.$name.$this->context.$this->cacheSpace; |
|
| 103 | 103 | $instance = $cache->fetch($id); |
| 104 | 104 | if ($instance) { |
| 105 | 105 | return $instance; |