@@ -32,7 +32,7 @@ |
||
32 | 32 | public function __invoke(string $varName, array $query, InjectorInterface $injector) |
33 | 33 | { |
34 | 34 | $type = $this->parameter->getType(); |
35 | - if ($type instanceof ReflectionNamedType && ! $type->isBuiltin()) { |
|
35 | + if ($type instanceof ReflectionNamedType && !$type->isBuiltin()) { |
|
36 | 36 | $inputClass = $type->getName(); |
37 | 37 | assert(class_exists($inputClass)); |
38 | 38 |
@@ -15,6 +15,6 @@ |
||
15 | 15 | #[Override] |
16 | 16 | public function render(ResourceObject $ro): never |
17 | 17 | { |
18 | - throw new MethodNotAllowedException($ro::class . '::options', 405); |
|
18 | + throw new MethodNotAllowedException($ro::class.'::options', 405); |
|
19 | 19 | } |
20 | 20 | } |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | */ |
110 | 110 | private function annotationLink(LinkType $link, ResourceObject $current, AbstractRequest $request): ResourceObject |
111 | 111 | { |
112 | - if (! is_array($current->body)) { |
|
113 | - throw new Exception\LinkQueryException('Only array is allowed for link in ' . $current::class, 500); |
|
112 | + if (!is_array($current->body)) { |
|
113 | + throw new Exception\LinkQueryException('Only array is allowed for link in '.$current::class, 500); |
|
114 | 114 | } |
115 | 115 | |
116 | - $classMethod = 'on' . ucfirst($request->method); |
|
116 | + $classMethod = 'on'.ucfirst($request->method); |
|
117 | 117 | /** @var list<Link> $annotations */ |
118 | 118 | $annotations = (new ReflectionMethod($current::class, $classMethod))->getAnnotations(); |
119 | 119 | if ($link->type === LinkType::CRAWL_LINK) { |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | return $this->invoker->invoke($request); |
152 | 152 | } |
153 | 153 | |
154 | - throw new LinkRelException("rel:{$link->key} class:" . $current::class, 500); |
|
154 | + throw new LinkRelException("rel:{$link->key} class:".$current::class, 500); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | private function crawl(array $annotations, LinkType $link, array &$body): void |
191 | 191 | { |
192 | 192 | foreach ($annotations as $annotation) { |
193 | - if (! $annotation instanceof Link || $annotation->crawl !== $link->key) { |
|
193 | + if (!$annotation instanceof Link || $annotation->crawl !== $link->key) { |
|
194 | 194 | continue; |
195 | 195 | } |
196 | 196 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | } |
213 | 213 | |
214 | 214 | /** @return array<mixed> */ |
215 | - private function getResponseBody(Request $request): array|null |
|
215 | + private function getResponseBody(Request $request): array | null |
|
216 | 216 | { |
217 | 217 | $body = $this->invokeRecursive($request)->body; |
218 | 218 | assert(is_array($body) || $body === null); |
@@ -35,6 +35,6 @@ |
||
35 | 35 | #[Override] |
36 | 36 | public function __toString() |
37 | 37 | { |
38 | - return "{$this->scheme}://{$this->host}{$this->path}" . ($this->query ? '?' . http_build_query($this->query) : ''); |
|
38 | + return "{$this->scheme}://{$this->host}{$this->path}".($this->query ? '?'.http_build_query($this->query) : ''); |
|
39 | 39 | } |
40 | 40 | } |
@@ -53,20 +53,20 @@ discard block |
||
53 | 53 | /** @return OptionsMethodsResponse */ |
54 | 54 | public function __invoke(ResourceObject $ro, string $requestMethod): array |
55 | 55 | { |
56 | - $method = new ReflectionMethod($ro::class, 'on' . $requestMethod); |
|
56 | + $method = new ReflectionMethod($ro::class, 'on'.$requestMethod); |
|
57 | 57 | $ins = $this->getInMap($method); |
58 | 58 | [$doc, $paramDoc] = (new OptionsMethodDocBolck())($method); |
59 | 59 | $methodOption = $doc; |
60 | 60 | $paramMetas = (new OptionsMethodRequest())($method, $paramDoc, $ins); |
61 | 61 | $schema = $this->getJsonSchema($method); |
62 | - $request = ! empty($paramMetas) ? ['request' => $paramMetas] : []; |
|
62 | + $request = !empty($paramMetas) ? ['request' => $paramMetas] : []; |
|
63 | 63 | $methodOption += $request; |
64 | - if (! empty($schema)) { |
|
64 | + if (!empty($schema)) { |
|
65 | 65 | $methodOption += ['schema' => $schema]; |
66 | 66 | } |
67 | 67 | |
68 | 68 | $extras = $this->getMethodExtras($method); |
69 | - if (! empty($extras)) { |
|
69 | + if (!empty($extras)) { |
|
70 | 70 | $methodOption += $extras; |
71 | 71 | } |
72 | 72 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $extras['links'][] = $annotation; |
88 | 88 | } |
89 | 89 | |
90 | - if (! ($annotation instanceof Embed)) { |
|
90 | + if (!($annotation instanceof Embed)) { |
|
91 | 91 | continue; |
92 | 92 | } |
93 | 93 | |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | private function getJsonSchema(ReflectionMethod $method): array |
119 | 119 | { |
120 | 120 | $schema = $method->getAnnotation(JsonSchema::class); |
121 | - if (! $schema instanceof JsonSchema) { |
|
121 | + if (!$schema instanceof JsonSchema) { |
|
122 | 122 | return []; |
123 | 123 | } |
124 | 124 | |
125 | - $schemaFile = $this->schemaDir . '/' . $schema->schema; |
|
126 | - if (! file_exists($schemaFile)) { |
|
125 | + $schemaFile = $this->schemaDir.'/'.$schema->schema; |
|
126 | + if (!file_exists($schemaFile)) { |
|
127 | 127 | return []; |
128 | 128 | } |
129 | 129 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | public function getInsFromMethodAnnotations(array $annotations, array $ins): array |
142 | 142 | { |
143 | 143 | foreach ($annotations as $annotation) { |
144 | - if (! ($annotation instanceof AbstractWebContextParam)) { |
|
144 | + if (!($annotation instanceof AbstractWebContextParam)) { |
|
145 | 145 | continue; |
146 | 146 | } |
147 | 147 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $attributes = $parameter->getAttributes(); |
170 | 170 | foreach ($attributes as $attribute) { |
171 | 171 | $instance = $attribute->newInstance(); |
172 | - if (! ($instance instanceof AbstractWebContextParam)) { |
|
172 | + if (!($instance instanceof AbstractWebContextParam)) { |
|
173 | 173 | continue; |
174 | 174 | } |
175 | 175 |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | #[\Override] |
26 | 26 | public function invoke(AbstractRequest $request): ResourceObject |
27 | 27 | { |
28 | - $callable = [$request->resourceObject, 'on' . ucfirst($request->method)]; |
|
29 | - if (! is_callable($callable)) { |
|
28 | + $callable = [$request->resourceObject, 'on'.ucfirst($request->method)]; |
|
29 | + if (!is_callable($callable)) { |
|
30 | 30 | // OPTIONS or HEAD |
31 | 31 | return ($this->extraMethod)($request, $this); |
32 | 32 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | throw $e; |
43 | 43 | } |
44 | - if (! $response instanceof ResourceObject) { |
|
44 | + if (!$response instanceof ResourceObject) { |
|
45 | 45 | $request->resourceObject->body = $response; |
46 | 46 | $response = $request->resourceObject; |
47 | 47 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | * |
17 | 17 | * @param Query $query |
18 | 18 | */ |
19 | - public function __invoke(array|null $query = null): ResourceObject; |
|
19 | + public function __invoke(array | null $query = null): ResourceObject; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Set query |
@@ -69,7 +69,7 @@ |
||
69 | 69 | $type = $tagType === 'int' ? 'integer' : $tagType; |
70 | 70 | $params[$varName] = ['type' => $type]; |
71 | 71 | $description = (string) $tag->getDescription(); |
72 | - if (! $description) { |
|
72 | + if (!$description) { |
|
73 | 73 | continue; |
74 | 74 | } |
75 | 75 |
@@ -22,8 +22,8 @@ |
||
22 | 22 | public function __invoke(string $uri, array $query = []): Uri |
23 | 23 | { |
24 | 24 | $parsedUrl = (array) parse_url($uri); |
25 | - if (! array_key_exists('scheme', $parsedUrl)) { |
|
26 | - $uri = $this->schemaHost . $uri; |
|
25 | + if (!array_key_exists('scheme', $parsedUrl)) { |
|
26 | + $uri = $this->schemaHost.$uri; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | return new Uri($uri, $query); |