@@ -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); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function render(ResourceObject $ro) |
38 | 38 | { |
39 | - $urlSchema = (string) parse_url((string) $ro->uri, PHP_URL_SCHEME); |
|
39 | + $urlSchema = (string) parse_url((string) $ro->uri, PHP_URL_SCHEME); |
|
40 | 40 | $urlHost = (string) parse_url((string) $ro->uri, PHP_URL_HOST); |
41 | 41 | $locationUri = sprintf('%s://%s%s', $urlSchema, $urlHost, $ro->headers['Location']); |
42 | 42 | try { |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | |
57 | 57 | private function getReverseMatchedLink(string $uri) : string |
58 | 58 | { |
59 | - $routeName = (string) parse_url($uri, PHP_URL_PATH); |
|
60 | - $urlQuery = (string) parse_url($uri, PHP_URL_QUERY); |
|
59 | + $routeName = (string) parse_url($uri, PHP_URL_PATH); |
|
60 | + $urlQuery = (string) parse_url($uri, PHP_URL_QUERY); |
|
61 | 61 | $urlQuery ? parse_str($urlQuery, $value) : $value = []; |
62 | 62 | if ($value === []) { |
63 | 63 | return $uri; |
@@ -158,7 +158,7 @@ |
||
158 | 158 | { |
159 | 159 | list(, $method, $uri) = $globals['argv']; |
160 | 160 | $urlQuery = parse_url($uri, PHP_URL_QUERY); |
161 | - $urlPath = parse_url($uri, PHP_URL_PATH); |
|
161 | + $urlPath = parse_url($uri, PHP_URL_PATH); |
|
162 | 162 | $query = []; |
163 | 163 | if ($urlQuery) { |
164 | 164 | parse_str($urlQuery, $query); |
@@ -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 list($className)) { |
58 | 58 | $this->scanClass($injector, $reader, $namedParams, $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,9 +82,9 @@ discard block |
||
82 | 82 | ); |
83 | 83 | |
84 | 84 | $this->invokeTypicalReuqest($appName, $context); |
85 | - $fies = '<?php declare(strict_types=1);' . PHP_EOL; |
|
85 | + $fies = '<?php declare(strict_types=1);'.PHP_EOL; |
|
86 | 86 | foreach ($this->classes as $class) { |
87 | - $isAutoloadFailed = ! class_exists($class, false) && ! interface_exists($class, false) && ! trait_exists($class, false); // could be phpdoc tag by anotation loader |
|
87 | + $isAutoloadFailed = !class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false); // could be phpdoc tag by anotation loader |
|
88 | 88 | if ($isAutoloadFailed) { |
89 | 89 | continue; |
90 | 90 | } |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | $this->getRelativePath($appDir, (string) (new \ReflectionClass($class))->getFileName()) |
94 | 94 | ); |
95 | 95 | } |
96 | - $fies .= "require __DIR__ . '/vendor/autoload.php';" . PHP_EOL; |
|
97 | - $loaderFile = realpath($appDir) . '/autoload.php'; |
|
96 | + $fies .= "require __DIR__ . '/vendor/autoload.php';".PHP_EOL; |
|
97 | + $loaderFile = realpath($appDir).'/autoload.php'; |
|
98 | 98 | file_put_contents($loaderFile, $fies); |
99 | 99 | |
100 | 100 | return $loaderFile; |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | { |
105 | 105 | $dir = (string) realpath($rootDir); |
106 | 106 | if (strpos($file, $dir) !== false) { |
107 | - return (string) preg_replace('#^' . preg_quote($dir, '#') . '#', "__DIR__ . '", $file); |
|
107 | + return (string) preg_replace('#^'.preg_quote($dir, '#').'#', "__DIR__ . '", $file); |
|
108 | 108 | } |
109 | 109 | |
110 | - return "'" . $file; |
|
110 | + return "'".$file; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | private function invokeTypicalReuqest(string $appName, string $context) |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | private function saveNamedParam(NamedParameterInterface $namedParameter, $instance, string $method) : void |
150 | 150 | { |
151 | 151 | // named parameter |
152 | - if (! \in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) { |
|
152 | + if (!\in_array($method, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) { |
|
153 | 153 | return; |
154 | 154 | } |
155 | 155 | $callable = [$instance, $method]; |
156 | - if (! is_callable($callable)) { |
|
156 | + if (!is_callable($callable)) { |
|
157 | 157 | return; |
158 | 158 | } |
159 | 159 | try { |