@@ -21,7 +21,7 @@ |
||
21 | 21 | */ |
22 | 22 | public function hydrate($object, $source, DocumentHydrator $hydrator) |
23 | 23 | { |
24 | - if (! $object instanceof MetadataAwareInterface) { |
|
24 | + if (!$object instanceof MetadataAwareInterface) { |
|
25 | 25 | throw new InvalidDocumentException(sprintf( |
26 | 26 | 'Given instance of "%s" does not implements "%s"', |
27 | 27 | get_class($object), |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function hydrate($object, $source, DocumentHydrator $hydrator) |
26 | 26 | { |
27 | - if (! $object instanceof RelationshipsAwareInterface) { |
|
27 | + if (!$object instanceof RelationshipsAwareInterface) { |
|
28 | 28 | throw new InvalidDocumentException(sprintf( |
29 | 29 | 'Given instance of "%s" does not implements "%s"', |
30 | 30 | get_class($object), |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function createRelationship($source, DocumentHydrator $hydrator): AbstractRelationship |
51 | 51 | { |
52 | - if (! isset($source->data)) { |
|
52 | + if (!isset($source->data)) { |
|
53 | 53 | return $this->processNoDataRelationship($source, $hydrator); |
54 | 54 | } |
55 | 55 | |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | */ |
128 | 128 | protected function createResourceIdentifier($source, DocumentHydrator $hydrator): ResourceIdentifierObject |
129 | 129 | { |
130 | - if (! isset($source->id)) { |
|
130 | + if (!isset($source->id)) { |
|
131 | 131 | throw new InvalidDocumentException('Resource identifier contains no ID'); |
132 | 132 | } |
133 | 133 | |
134 | - if (! isset($source->type)) { |
|
134 | + if (!isset($source->type)) { |
|
135 | 135 | throw new InvalidDocumentException('Resource identifier contains no type'); |
136 | 136 | } |
137 | 137 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function hydrate($object, $source, DocumentHydrator $hydrator) |
24 | 24 | { |
25 | - if (! $object instanceof LinksAwareInterface) { |
|
25 | + if (!$object instanceof LinksAwareInterface) { |
|
26 | 26 | throw new InvalidDocumentException(sprintf( |
27 | 27 | 'Given instance of "%s" does not implements "%s"', |
28 | 28 | get_class($object), |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | return new LinkObject($source); |
52 | 52 | } |
53 | 53 | |
54 | - if (! isset($source->href)) { |
|
54 | + if (!isset($source->href)) { |
|
55 | 55 | throw new InvalidDocumentException('Link must be a string or an object contains "href" attribute.'); |
56 | 56 | } |
57 | 57 |
@@ -85,7 +85,7 @@ |
||
85 | 85 | |
86 | 86 | foreach ($this->links as $name => $link) |
87 | 87 | { |
88 | - if (! $link->hasMetadata()) { |
|
88 | + if (!$link->hasMetadata()) { |
|
89 | 89 | $links[$name] = $link->getReference(); |
90 | 90 | continue; |
91 | 91 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function hydrate($object, $source, DocumentHydrator $hydrator) |
24 | 24 | { |
25 | - if (! $object instanceof ErrorsAwareInterface) { |
|
25 | + if (!$object instanceof ErrorsAwareInterface) { |
|
26 | 26 | throw new InvalidDocumentException(sprintf( |
27 | 27 | 'Given instance of "%s" does not implements "%s"', |
28 | 28 | get_class($object), |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | foreach (['id', 'status', 'code', 'title', 'detail'] as $property) |
53 | 53 | { |
54 | 54 | if (isset($source->$property)) { |
55 | - $error->{'set' . ucfirst($property)}($source->$property); |
|
55 | + $error->{'set'.ucfirst($property)}($source->$property); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $decoded = json_decode($content); |
79 | 79 | |
80 | 80 | if (json_last_error() !== JSON_ERROR_NONE) { |
81 | - throw new \RuntimeException('Decoding error: "' . json_last_error_msg() . '""'); |
|
81 | + throw new \RuntimeException('Decoding error: "'.json_last_error_msg().'""'); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | return $this->hydrator->hydrate($decoded); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $encoded = json_encode($document->toArray()); |
96 | 96 | |
97 | 97 | if (json_last_error() !== JSON_ERROR_NONE) { |
98 | - throw new \RuntimeException('Encoding error: "' . json_last_error_msg() . '""'); |
|
98 | + throw new \RuntimeException('Encoding error: "'.json_last_error_msg().'""'); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | $stream = fopen('php://memory', 'r+'); |
@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | public function hydrate($object, $source, DocumentHydrator $hydrator) |
24 | 24 | { |
25 | - if (! $object instanceof AbstractDocument) { |
|
25 | + if (!$object instanceof AbstractDocument) { |
|
26 | 26 | throw new InvalidDocumentException(sprintf( |
27 | 27 | 'Only top-level of document can contains "jsonapi"-object. Instance of "%s" given.', |
28 | 28 | get_class($object) |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public function hydrate($object, $source, DocumentHydrator $hydrator) |
22 | 22 | { |
23 | - if (! $object instanceof IncludedResourcesAwareInterface) { |
|
23 | + if (!$object instanceof IncludedResourcesAwareInterface) { |
|
24 | 24 | throw new InvalidDocumentException(sprintf( |
25 | 25 | 'Given instance of "%s" does not implements "%s"', |
26 | 26 | get_class($object), |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function hydrate($source): AbstractDocument |
51 | 51 | { |
52 | - if (! isset($source->data)) { |
|
52 | + if (!isset($source->data)) { |
|
53 | 53 | return $this->processNoDataDocument($source); |
54 | 54 | } |
55 | 55 | |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function hydrateResource($source): ResourceObject |
141 | 141 | { |
142 | - if (! isset($source->id)) { |
|
142 | + if (!isset($source->id)) { |
|
143 | 143 | throw new InvalidDocumentException('Resource contains no ID'); |
144 | 144 | } |
145 | 145 | |
146 | - if (! isset($source->type)) { |
|
146 | + if (!isset($source->type)) { |
|
147 | 147 | throw new InvalidDocumentException('Resource contains no type'); |
148 | 148 | } |
149 | 149 |