@@ -30,7 +30,7 @@ |
||
| 30 | 30 | { |
| 31 | 31 | $this->document = $body; |
| 32 | 32 | |
| 33 | - if (! isset($headers['Content-Type'])) { |
|
| 33 | + if (!isset($headers['Content-Type'])) { |
|
| 34 | 34 | $headers['Content-Type'] = ['application/vnd.api+json']; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -54,10 +54,10 @@ discard block |
||
| 54 | 54 | static protected function registerAnnotations() |
| 55 | 55 | { |
| 56 | 56 | if (self::$annotationsRegistered === false) { |
| 57 | - AnnotationRegistry::registerFile(__DIR__ . '/../Annotation/ResourceIdentifier.php'); |
|
| 58 | - AnnotationRegistry::registerFile(__DIR__ . '/../Annotation/Relationship.php'); |
|
| 59 | - AnnotationRegistry::registerFile(__DIR__ . '/../Annotation/Attribute.php'); |
|
| 60 | - AnnotationRegistry::registerFile(__DIR__ . '/../Annotation/Link.php'); |
|
| 57 | + AnnotationRegistry::registerFile(__DIR__.'/../Annotation/ResourceIdentifier.php'); |
|
| 58 | + AnnotationRegistry::registerFile(__DIR__.'/../Annotation/Relationship.php'); |
|
| 59 | + AnnotationRegistry::registerFile(__DIR__.'/../Annotation/Attribute.php'); |
|
| 60 | + AnnotationRegistry::registerFile(__DIR__.'/../Annotation/Link.php'); |
|
| 61 | 61 | |
| 62 | 62 | self::$annotationsRegistered = true; |
| 63 | 63 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | protected function createLink(LinkAnnotation $annotation): Link |
| 73 | 73 | { |
| 74 | - if (! preg_match(self::RESOURCE_PATTERN, $annotation->resource, $matches)) { |
|
| 74 | + if (!preg_match(self::RESOURCE_PATTERN, $annotation->resource, $matches)) { |
|
| 75 | 75 | throw new \LogicException(sprintf('Invalid resource definition: "%s"', $annotation->resource)); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | foreach (['get', 'is'] as $prefix) |
| 102 | 102 | { |
| 103 | - $getter = $prefix . ucfirst($name); |
|
| 103 | + $getter = $prefix.ucfirst($name); |
|
| 104 | 104 | |
| 105 | 105 | if ($class->hasMethod($getter) && $class->getMethod($getter)->isPublic()) { |
| 106 | 106 | return $getter; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | throw new \LogicException(sprintf( |
| 111 | - 'Getter-method for the property "%s" cannot be resolved automatically. ' . |
|
| 111 | + 'Getter-method for the property "%s" cannot be resolved automatically. '. |
|
| 112 | 112 | 'Probably there is no get%2$s() or is%2$s() method or it is not public.', |
| 113 | 113 | $name, ucfirst($name) |
| 114 | 114 | )); |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $name = $property->getName(); |
| 126 | 126 | $class = $property->getDeclaringClass(); |
| 127 | 127 | |
| 128 | - $setter = 'set' . ucfirst($name); |
|
| 128 | + $setter = 'set'.ucfirst($name); |
|
| 129 | 129 | |
| 130 | 130 | if ($class->hasMethod($setter) && $class->getMethod($setter)->isPublic()) { |
| 131 | 131 | return $setter; |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | */ |
| 41 | 41 | public function getDefinition(string $class): Definition |
| 42 | 42 | { |
| 43 | - if (! isset($this->definitionCache[$class])) { |
|
| 43 | + if (!isset($this->definitionCache[$class])) { |
|
| 44 | 44 | $reflection = new \ReflectionClass($class); |
| 45 | 45 | |
| 46 | 46 | $this->definitionCache[$class] = $this->createDefinition($reflection); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | protected function validateMethodAttribute(AttributeAnnotation $annotation, \ReflectionMethod $method) |
| 91 | 91 | { |
| 92 | - if (! $method->isPublic()) { |
|
| 92 | + if (!$method->isPublic()) { |
|
| 93 | 93 | throw new \LogicException(sprintf( |
| 94 | 94 | 'Attribute annotation can be applied only to non public method "%s".', |
| 95 | 95 | $method->getName() |
@@ -205,13 +205,13 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | protected function processDataType(string $definition, Attribute $attribute) |
| 207 | 207 | { |
| 208 | - if (! preg_match(self::DATATYPE_PATTERN, $definition, $matches)) { |
|
| 208 | + if (!preg_match(self::DATATYPE_PATTERN, $definition, $matches)) { |
|
| 209 | 209 | throw new \LogicException(sprintf('Data-type definition "%s" is invalid.', $definition)); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | $attribute->setType($matches['type']); |
| 213 | 213 | |
| 214 | - if (! empty($matches['many'])) { |
|
| 214 | + if (!empty($matches['many'])) { |
|
| 215 | 215 | $attribute->setMany(); |
| 216 | 216 | } |
| 217 | 217 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function process(array $config, Definition $definition) |
| 20 | 20 | { |
| 21 | - if (! isset($config['relationships'])) { |
|
| 21 | + if (!isset($config['relationships'])) { |
|
| 22 | 22 | return; |
| 23 | 23 | } |
| 24 | 24 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | protected function handleLinks(array $data, Relationship $relationship) |
| 70 | 70 | { |
| 71 | - if (! isset($data['links'])) { |
|
| 71 | + if (!isset($data['links'])) { |
|
| 72 | 72 | return; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | $definition->setType($config['type']); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - if (! isset($config['links'])) { |
|
| 24 | + if (!isset($config['links'])) { |
|
| 25 | 25 | return; |
| 26 | 26 | } |
| 27 | 27 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function createLink(string $name, array $data): Link |
| 29 | 29 | { |
| 30 | - if (! preg_match(self::RESOURCE_PATTERN, $data['resource'], $matches)) { |
|
| 30 | + if (!preg_match(self::RESOURCE_PATTERN, $data['resource'], $matches)) { |
|
| 31 | 31 | throw new \LogicException(sprintf('Invalid resource definition: "%s"', $data['resource'])); |
| 32 | 32 | } |
| 33 | 33 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | foreach (['get', 'is'] as $prefix) |
| 56 | 56 | { |
| 57 | - $getter = $prefix . ucfirst($name); |
|
| 57 | + $getter = $prefix.ucfirst($name); |
|
| 58 | 58 | |
| 59 | 59 | if ($reflection->hasMethod($getter) && $reflection->getMethod($getter)->isPublic()) { |
| 60 | 60 | return $getter; |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | throw new \LogicException(sprintf( |
| 65 | - 'Getter-method for "%s" cannot be resolved automatically. ' . |
|
| 65 | + 'Getter-method for "%s" cannot be resolved automatically. '. |
|
| 66 | 66 | 'Probably there is no get%2$s() or is%2$s() method or it is not public.', |
| 67 | 67 | $name, ucfirst($name) |
| 68 | 68 | )); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | protected function resolveSetter(\ReflectionClass $reflection, string $name) |
| 79 | 79 | { |
| 80 | - $setter = 'set' . ucfirst($name); |
|
| 80 | + $setter = 'set'.ucfirst($name); |
|
| 81 | 81 | |
| 82 | 82 | if ($reflection->hasMethod($setter) && $reflection->getMethod($setter)->isPublic()) { |
| 83 | 83 | return $setter; |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function process(array $config, Definition $definition) |
| 25 | 25 | { |
| 26 | - if (! isset($config['attributes'])) { |
|
| 26 | + if (!isset($config['attributes'])) { |
|
| 27 | 27 | return; |
| 28 | 28 | } |
| 29 | 29 | |
@@ -94,13 +94,13 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | protected function processDataType(string $definition, Attribute $attribute) |
| 96 | 96 | { |
| 97 | - if (! preg_match(self::DATATYPE_PATTERN, $definition, $matches)) { |
|
| 97 | + if (!preg_match(self::DATATYPE_PATTERN, $definition, $matches)) { |
|
| 98 | 98 | throw new \LogicException(sprintf('Data-type definition "%s" is invalid.', $definition)); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | $attribute->setType($matches['type']); |
| 102 | 102 | |
| 103 | - if (! empty($matches['many'])) { |
|
| 103 | + if (!empty($matches['many'])) { |
|
| 104 | 104 | $attribute->setMany(); |
| 105 | 105 | } |
| 106 | 106 | |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | */ |
| 38 | 38 | public function getDefinition(string $class): Definition |
| 39 | 39 | { |
| 40 | - if (! isset($this->definitions[$class])) { |
|
| 40 | + if (!isset($this->definitions[$class])) { |
|
| 41 | 41 | $this->definitions[$class] = $this->createDefinition($class); |
| 42 | 42 | } |
| 43 | 43 | |