@@ -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 |
@@ -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 | } |
@@ -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 | } |
@@ -215,7 +215,7 @@ |
||
| 215 | 215 | * @param string|null $format |
| 216 | 216 | * @param array $context |
| 217 | 217 | * |
| 218 | - * @return bool|string |
|
| 218 | + * @return string|false |
|
| 219 | 219 | */ |
| 220 | 220 | private function getCacheKey(string $format = null, array $context) |
| 221 | 221 | { |
@@ -18,7 +18,6 @@ |
||
| 18 | 18 | * Converts {@see \Symfony\Component\Validator\ConstraintViolationListInterface} the API Problem spec (RFC 7807). |
| 19 | 19 | * |
| 20 | 20 | * @see https://tools.ietf.org/html/rfc7807 |
| 21 | - |
|
| 22 | 21 | * @author Kévin Dunglas <[email protected]> |
| 23 | 22 | */ |
| 24 | 23 | final class ConstraintViolationListNormalizer implements NormalizerInterface |
@@ -314,8 +314,7 @@ |
||
| 314 | 314 | $valueType = $type->isCollection() ? $type->getCollectionValueType() : $type; |
| 315 | 315 | |
| 316 | 316 | switch ($valueType ? $valueType->getBuiltinType() : null) { |
| 317 | - case Type::BUILTIN_TYPE_STRING: |
|
| 318 | - $valueSchema['type'] = 'string'; |
|
| 317 | + case Type::BUILTIN_TYPE_STRING : $valueSchema['type'] = 'string'; |
|
| 319 | 318 | break; |
| 320 | 319 | |
| 321 | 320 | case Type::BUILTIN_TYPE_INT: |
@@ -92,22 +92,22 @@ discard block |
||
| 92 | 92 | $xpath = new \DOMXpath($resources); |
| 93 | 93 | |
| 94 | 94 | $metadata = [ |
| 95 | - 'shortName' => $metadata->getAttribute('shortName') ?: null, |
|
| 96 | - 'description' => $metadata->getAttribute('description') ?: null, |
|
| 97 | - 'iri' => $metadata->getAttribute('iri') ?: null, |
|
| 98 | - 'itemOperations' => $this->getOperations($xpath->query('./itemOperations/operation', $metadata)) ?: null, |
|
| 99 | - 'collectionOperations' => $this->getOperations($xpath->query('./collectionOperations/operation', $metadata)) ?: null, |
|
| 100 | - 'attributes' => $this->getAttributes($xpath->query('./attributes/attribute', $metadata)), |
|
| 95 | + 'shortName' => $metadata->getAttribute('shortName') ?: null, |
|
| 96 | + 'description' => $metadata->getAttribute('description') ?: null, |
|
| 97 | + 'iri' => $metadata->getAttribute('iri') ?: null, |
|
| 98 | + 'itemOperations' => $this->getOperations($xpath->query('./itemOperations/operation', $metadata)) ?: null, |
|
| 99 | + 'collectionOperations' => $this->getOperations($xpath->query('./collectionOperations/operation', $metadata)) ?: null, |
|
| 100 | + 'attributes' => $this->getAttributes($xpath->query('./attributes/attribute', $metadata)), |
|
| 101 | 101 | ]; |
| 102 | 102 | |
| 103 | 103 | if (!$parentResourceMetadata) { |
| 104 | 104 | return new ResourceMetadata( |
| 105 | - $metadata['shortName'], |
|
| 106 | - $metadata['description'], |
|
| 107 | - $metadata['iri'], |
|
| 108 | - $metadata['itemOperations'], |
|
| 109 | - $metadata['collectionOperations'], |
|
| 110 | - $metadata['attributes'] |
|
| 105 | + $metadata['shortName'], |
|
| 106 | + $metadata['description'], |
|
| 107 | + $metadata['iri'], |
|
| 108 | + $metadata['itemOperations'], |
|
| 109 | + $metadata['collectionOperations'], |
|
| 110 | + $metadata['attributes'] |
|
| 111 | 111 | ); |
| 112 | 112 | } |
| 113 | 113 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | foreach ($query as $operation) { |
| 163 | 163 | $key = $operation->getAttribute('key'); |
| 164 | 164 | $operations[$key] = [ |
| 165 | - 'method' => $operation->getAttribute('method'), |
|
| 165 | + 'method' => $operation->getAttribute('method'), |
|
| 166 | 166 | ]; |
| 167 | 167 | |
| 168 | 168 | $path = $operation->getAttribute('path'); |