@@ -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); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | #[Override] |
| 30 | 30 | public function href(string $rel, AbstractRequest $request, array $query): array |
| 31 | 31 | { |
| 32 | - $classMethod = 'on' . ucfirst($request->method); |
|
| 32 | + $classMethod = 'on'.ucfirst($request->method); |
|
| 33 | 33 | $annotations = (new ReflectionMethod($request->resourceObject::class, $classMethod))->getAnnotations(); |
| 34 | 34 | foreach ($annotations as $annotation) { |
| 35 | 35 | if ($this->isValidLinkAnnotation($annotation, $rel)) { |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - throw new LinkException("rel:{$rel} class:" . $request->resourceObject::class, 500); |
|
| 42 | + throw new LinkException("rel:{$rel} class:".$request->resourceObject::class, 500); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | private function isValidLinkAnnotation(object $annotation, string $rel): bool |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $ro->headers['Content-Type'] = 'application/json'; |
| 47 | 47 | $allows = $this->getAllows((new ReflectionClass($ro))->getMethods()); |
| 48 | 48 | $ro->headers['Allow'] = implode(', ', $allows); |
| 49 | - $ro->view = $this->optionsBody ? (string) json_encode($this->getEntityBody($ro, $allows), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . PHP_EOL : ''; |
|
| 49 | + $ro->view = $this->optionsBody ? (string) json_encode($this->getEntityBody($ro, $allows), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES).PHP_EOL : ''; |
|
| 50 | 50 | |
| 51 | 51 | return $ro->view; |
| 52 | 52 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $allows = []; |
| 65 | 65 | foreach ($methods as $method) { |
| 66 | - if (! in_array($method->name, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) { |
|
| 66 | + if (!in_array($method->name, ['onGet', 'onPost', 'onPut', 'onPatch', 'onDelete', 'onHead'], true)) { |
|
| 67 | 67 | continue; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | public function __construct( |
| 25 | 25 | private readonly string $jsonSchemaDir = '', |
| 26 | 26 | private readonly string $jsonValidateDir = '', |
| 27 | - AbstractModule|null $module = null, |
|
| 27 | + AbstractModule | null $module = null, |
|
| 28 | 28 | ) { |
| 29 | 29 | parent::__construct($module); |
| 30 | 30 | } |
@@ -17,9 +17,9 @@ |
||
| 17 | 17 | /** @param string $jsonSchemaHost Json-schema host name ex) https://example.com/schema/ */ |
| 18 | 18 | public function __construct( |
| 19 | 19 | private readonly string $jsonSchemaHost, |
| 20 | - AbstractModule|null $module = null, |
|
| 20 | + AbstractModule | null $module = null, |
|
| 21 | 21 | ) { |
| 22 | - if (! filter_var($jsonSchemaHost, FILTER_VALIDATE_URL)) { |
|
| 22 | + if (!filter_var($jsonSchemaHost, FILTER_VALIDATE_URL)) { |
|
| 23 | 23 | throw new InvalidSchemaUriException($jsonSchemaHost); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -33,6 +33,6 @@ |
||
| 33 | 33 | return $ro; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - throw new MethodNotAllowedException($request->resourceObject::class . "::{({$request->method}}()", 405); |
|
| 36 | + throw new MethodNotAllowedException($request->resourceObject::class."::{({$request->method}}()", 405); |
|
| 37 | 37 | } |
| 38 | 38 | } |