@@ -55,7 +55,7 @@ |
||
| 55 | 55 | |
| 56 | 56 | $source = preg_replace_callback( |
| 57 | 57 | '/(^|(?<=&))[^=[&]+/', |
| 58 | - function ($key) { |
|
| 58 | + function($key) { |
|
| 59 | 59 | return bin2hex(urldecode($key[0])); |
| 60 | 60 | }, |
| 61 | 61 | $source |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | $this->contextBuilder = $contextBuilder; |
| 57 | 57 | $this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor(); |
| 58 | 58 | |
| 59 | - $this->setCircularReferenceHandler(function ($object) { |
|
| 59 | + $this->setCircularReferenceHandler(function($object) { |
|
| 60 | 60 | return $this->iriConverter->getIriFromItem($object); |
| 61 | 61 | }); |
| 62 | 62 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | ->useAttributeAsKey('format') |
| 41 | 41 | ->beforeNormalization() |
| 42 | 42 | ->ifArray() |
| 43 | - ->then(function ($v) { |
|
| 43 | + ->then(function($v) { |
|
| 44 | 44 | foreach ($v as $format => $value) { |
| 45 | 45 | if (isset($value['mime_types'])) { |
| 46 | 46 | continue; |
@@ -307,21 +307,21 @@ |
||
| 307 | 307 | return $value; |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | - /** |
|
| 311 | - * Normalize the values array. |
|
| 312 | - * |
|
| 313 | - * @param array $values |
|
| 314 | - * |
|
| 315 | - * @return array |
|
| 316 | - */ |
|
| 317 | - private function normalizeValues(array $values) : array |
|
| 318 | - { |
|
| 319 | - foreach ($values as $key => $value) { |
|
| 320 | - if (!is_int($key) || !is_string($value)) { |
|
| 321 | - unset($values[$key]); |
|
| 322 | - } |
|
| 323 | - } |
|
| 324 | - |
|
| 325 | - return array_values($values); |
|
| 326 | - } |
|
| 310 | + /** |
|
| 311 | + * Normalize the values array. |
|
| 312 | + * |
|
| 313 | + * @param array $values |
|
| 314 | + * |
|
| 315 | + * @return array |
|
| 316 | + */ |
|
| 317 | + private function normalizeValues(array $values) : array |
|
| 318 | + { |
|
| 319 | + foreach ($values as $key => $value) { |
|
| 320 | + if (!is_int($key) || !is_string($value)) { |
|
| 321 | + unset($values[$key]); |
|
| 322 | + } |
|
| 323 | + } |
|
| 324 | + |
|
| 325 | + return array_values($values); |
|
| 326 | + } |
|
| 327 | 327 | } |
@@ -139,7 +139,7 @@ |
||
| 139 | 139 | * |
| 140 | 140 | * @param string $property |
| 141 | 141 | * |
| 142 | - * @return array |
|
| 142 | + * @return string |
|
| 143 | 143 | */ |
| 144 | 144 | protected function splitPropertyParts(string $property) : array |
| 145 | 145 | { |
@@ -95,22 +95,22 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | $metadata = [ |
| 98 | - 'shortName' => $metadata->getAttribute('shortName') ?: null, |
|
| 99 | - 'description' => $metadata->getAttribute('description') ?: null, |
|
| 100 | - 'iri' => $metadata->getAttribute('iri') ?: null, |
|
| 101 | - 'itemOperations' => $this->getOperations($xpath->query('./itemOperations/operation', $metadata)) ?: null, |
|
| 102 | - 'collectionOperations' => $this->getOperations($xpath->query('./collectionOperations/operation', $metadata)) ?: null, |
|
| 103 | - 'attributes' => $this->getAttributes($xpath->query('./attributes/attribute', $metadata)) ?? [], |
|
| 98 | + 'shortName' => $metadata->getAttribute('shortName') ?: null, |
|
| 99 | + 'description' => $metadata->getAttribute('description') ?: null, |
|
| 100 | + 'iri' => $metadata->getAttribute('iri') ?: null, |
|
| 101 | + 'itemOperations' => $this->getOperations($xpath->query('./itemOperations/operation', $metadata)) ?: null, |
|
| 102 | + 'collectionOperations' => $this->getOperations($xpath->query('./collectionOperations/operation', $metadata)) ?: null, |
|
| 103 | + 'attributes' => $this->getAttributes($xpath->query('./attributes/attribute', $metadata)) ?? [], |
|
| 104 | 104 | ]; |
| 105 | 105 | |
| 106 | 106 | if (!$parentResourceMetadata) { |
| 107 | 107 | return new ResourceMetadata( |
| 108 | - $metadata['shortName'], |
|
| 109 | - $metadata['description'], |
|
| 110 | - $metadata['iri'], |
|
| 111 | - $metadata['itemOperations'], |
|
| 112 | - $metadata['collectionOperations'], |
|
| 113 | - $metadata['attributes'] |
|
| 108 | + $metadata['shortName'], |
|
| 109 | + $metadata['description'], |
|
| 110 | + $metadata['iri'], |
|
| 111 | + $metadata['itemOperations'], |
|
| 112 | + $metadata['collectionOperations'], |
|
| 113 | + $metadata['attributes'] |
|
| 114 | 114 | ); |
| 115 | 115 | } |
| 116 | 116 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | foreach ($query as $operation) { |
| 142 | 142 | $key = $operation->getAttribute('key'); |
| 143 | 143 | $operations[$key] = [ |
| 144 | - 'method' => $operation->getAttribute('method'), |
|
| 144 | + 'method' => $operation->getAttribute('method'), |
|
| 145 | 145 | ]; |
| 146 | 146 | |
| 147 | 147 | $path = $operation->getAttribute('path'); |
@@ -392,7 +392,7 @@ |
||
| 392 | 392 | return ['$ref' => sprintf('#/definitions/%s', $this->resourceMetadataFactory->create($className)->getShortName())]; |
| 393 | 393 | } |
| 394 | 394 | } |
| 395 | - break; |
|
| 395 | + break; |
|
| 396 | 396 | } |
| 397 | 397 | } |
| 398 | 398 | |
@@ -66,12 +66,12 @@ |
||
| 66 | 66 | { |
| 67 | 67 | return [ |
| 68 | 68 | '_links' => ['self' => ['href' => $selfLink], |
| 69 | - 'curies' => [ |
|
| 70 | - ['name' => 'ap', |
|
| 71 | - 'href' => $this->urlGenerator->generate('api_hal_entrypoint').$this->docUri.'#section-{rel}', |
|
| 72 | - 'templated' => true, |
|
| 73 | - ], |
|
| 74 | - ], |
|
| 69 | + 'curies' => [ |
|
| 70 | + ['name' => 'ap', |
|
| 71 | + 'href' => $this->urlGenerator->generate('api_hal_entrypoint').$this->docUri.'#section-{rel}', |
|
| 72 | + 'templated' => true, |
|
| 73 | + ], |
|
| 74 | + ], |
|
| 75 | 75 | ], |
| 76 | 76 | ]; |
| 77 | 77 | } |
@@ -224,10 +224,10 @@ |
||
| 224 | 224 | $swaggerOperation[$methodSwagger]['responses'] = [ |
| 225 | 225 | '200' => [ |
| 226 | 226 | 'description' => 'Successful operation', |
| 227 | - 'schema' => [ |
|
| 227 | + 'schema' => [ |
|
| 228 | 228 | 'type' => 'array', |
| 229 | 229 | 'items' => ['$ref' => sprintf('#/definitions/%s', $shortName)] |
| 230 | - ], |
|
| 230 | + ], |
|
| 231 | 231 | ], |
| 232 | 232 | ]; |
| 233 | 233 | break; |