@@ -41,7 +41,7 @@ |
||
41 | 41 | $resources = []; |
42 | 42 | |
43 | 43 | foreach ($data as $resource) { |
44 | - if (! ($resource instanceof Resource)) { |
|
44 | + if (!($resource instanceof Resource)) { |
|
45 | 45 | $resource = new Resource($resource, $serializer); |
46 | 46 | } |
47 | 47 |
@@ -35,7 +35,7 @@ |
||
35 | 35 | foreach ($paths as $path) { |
36 | 36 | list($primary, $nested) = array_pad(explode('.', $path, 2), 2, null); |
37 | 37 | |
38 | - if (! isset($tree[$primary])) { |
|
38 | + if (!isset($tree[$primary])) { |
|
39 | 39 | $tree[$primary] = []; |
40 | 40 | } |
41 | 41 |
@@ -65,15 +65,15 @@ |
||
65 | 65 | { |
66 | 66 | $array = []; |
67 | 67 | |
68 | - if (! empty($this->data)) { |
|
68 | + if (!empty($this->data)) { |
|
69 | 69 | $array['data'] = $this->data->toIdentifier(); |
70 | 70 | } |
71 | 71 | |
72 | - if (! empty($this->meta)) { |
|
72 | + if (!empty($this->meta)) { |
|
73 | 73 | $array['meta'] = $this->meta; |
74 | 74 | } |
75 | 75 | |
76 | - if (! empty($this->links)) { |
|
76 | + if (!empty($this->links)) { |
|
77 | 77 | $array['links'] = $this->links; |
78 | 78 | } |
79 | 79 |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | foreach ($resource->getUnfilteredRelationships() as $relationship) { |
81 | 81 | $includedElement = $relationship->getData(); |
82 | 82 | |
83 | - if (! $includedElement instanceof ElementInterface) { |
|
83 | + if (!$includedElement instanceof ElementInterface) { |
|
84 | 84 | continue; |
85 | 85 | } |
86 | 86 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | // If this resource is the same as the top-level "data" |
89 | 89 | // resource, then we don't want it to show up again in the |
90 | 90 | // "included" array. |
91 | - if (! $includeParent && $child->getType() === $type && $child->getId() === $id) { |
|
91 | + if (!$includeParent && $child->getType() === $type && $child->getId() === $id) { |
|
92 | 92 | continue; |
93 | 93 | } |
94 | 94 | |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | { |
174 | 174 | $document = []; |
175 | 175 | |
176 | - if (! empty($this->links)) { |
|
176 | + if (!empty($this->links)) { |
|
177 | 177 | $document['links'] = $this->links; |
178 | 178 | } |
179 | 179 | |
180 | - if (! empty($this->data)) { |
|
180 | + if (!empty($this->data)) { |
|
181 | 181 | $document['data'] = $this->data->toArray(); |
182 | 182 | |
183 | 183 | $resources = $this->getIncluded($this->data); |
@@ -189,15 +189,15 @@ discard block |
||
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | - if (! empty($this->meta)) { |
|
192 | + if (!empty($this->meta)) { |
|
193 | 193 | $document['meta'] = $this->meta; |
194 | 194 | } |
195 | 195 | |
196 | - if (! empty($this->errors)) { |
|
196 | + if (!empty($this->errors)) { |
|
197 | 197 | $document['errors'] = $this->errors; |
198 | 198 | } |
199 | 199 | |
200 | - if (! empty($this->jsonapi)) { |
|
200 | + if (!empty($this->jsonapi)) { |
|
201 | 201 | $document['jsonapi'] = $this->jsonapi; |
202 | 202 | } |
203 | 203 |
@@ -98,7 +98,7 @@ |
||
98 | 98 | */ |
99 | 99 | protected function addPaginationLink($name, $url, array $queryParams, $offset, $limit) |
100 | 100 | { |
101 | - if (! isset($queryParams['page']) || ! is_array($queryParams['page'])) { |
|
101 | + if (!isset($queryParams['page']) || !is_array($queryParams['page'])) { |
|
102 | 102 | $queryParams['page'] = []; |
103 | 103 | } |
104 | 104 |
@@ -162,7 +162,7 @@ |
||
162 | 162 | { |
163 | 163 | $fields = $this->getInput('fields'); |
164 | 164 | |
165 | - if (! is_array($fields)) { |
|
165 | + if (!is_array($fields)) { |
|
166 | 166 | return []; |
167 | 167 | } |
168 | 168 |
@@ -74,7 +74,7 @@ |
||
74 | 74 | if (method_exists($this, $method)) { |
75 | 75 | $relationship = $this->$method($model); |
76 | 76 | |
77 | - if ($relationship !== null && ! ($relationship instanceof Relationship)) { |
|
77 | + if ($relationship !== null && !($relationship instanceof Relationship)) { |
|
78 | 78 | throw new LogicException('Relationship method must return null or an instance of Tobscure\JsonApi\Relationship'); |
79 | 79 | } |
80 | 80 |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | { |
78 | 78 | $array = $this->toIdentifier(); |
79 | 79 | |
80 | - if (! $this->isIdentifier()) { |
|
80 | + if (!$this->isIdentifier()) { |
|
81 | 81 | $attributes = $this->getAttributes(); |
82 | 82 | if ($attributes) { |
83 | 83 | $array['attributes'] = $attributes; |
@@ -91,26 +91,26 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | $links = []; |
94 | - if (! empty($this->links)) { |
|
94 | + if (!empty($this->links)) { |
|
95 | 95 | $links = $this->links; |
96 | 96 | } |
97 | 97 | $serializerLinks = $this->serializer->getLinks($this->data); |
98 | - if (! empty($serializerLinks)) { |
|
98 | + if (!empty($serializerLinks)) { |
|
99 | 99 | $links = array_merge($serializerLinks, $links); |
100 | 100 | } |
101 | - if (! empty($links)) { |
|
101 | + if (!empty($links)) { |
|
102 | 102 | $array['links'] = $links; |
103 | 103 | } |
104 | 104 | |
105 | 105 | $meta = []; |
106 | - if (! empty($this->meta)) { |
|
106 | + if (!empty($this->meta)) { |
|
107 | 107 | $meta = $this->meta; |
108 | 108 | } |
109 | 109 | $serializerMeta = $this->serializer->getMeta($this->data); |
110 | - if (! empty($serializerMeta)) { |
|
110 | + if (!empty($serializerMeta)) { |
|
111 | 111 | $meta = array_merge($serializerMeta, $meta); |
112 | 112 | } |
113 | - if (! empty($meta)) { |
|
113 | + if (!empty($meta)) { |
|
114 | 114 | $array['meta'] = $meta; |
115 | 115 | } |
116 | 116 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function isIdentifier() |
127 | 127 | { |
128 | - return ! is_object($this->data) && ! is_array($this->data); |
|
128 | + return !is_object($this->data) && !is_array($this->data); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function toIdentifier() |
135 | 135 | { |
136 | - if (! $this->data) { |
|
136 | + if (!$this->data) { |
|
137 | 137 | return; |
138 | 138 | } |
139 | 139 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | 'id' => $this->getId() |
143 | 143 | ]; |
144 | 144 | |
145 | - if (! empty($this->meta)) { |
|
145 | + if (!empty($this->meta)) { |
|
146 | 146 | $array['meta'] = $this->meta; |
147 | 147 | } |
148 | 148 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function getId() |
168 | 168 | { |
169 | - if (! is_object($this->data) && ! is_array($this->data)) { |
|
169 | + if (!is_object($this->data) && !is_array($this->data)) { |
|
170 | 170 | return (string) $this->data; |
171 | 171 | } |
172 | 172 |