@@ -39,7 +39,7 @@ |
||
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - throw new RuntimeException('Exception handler for '.get_class($e).' not found.'); |
|
| 42 | + throw new RuntimeException('Exception handler for ' . get_class($e) . ' not found.'); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -159,11 +159,11 @@ discard block |
||
| 159 | 159 | { |
| 160 | 160 | $document = []; |
| 161 | 161 | |
| 162 | - if (! empty($this->links)) { |
|
| 162 | + if (!empty($this->links)) { |
|
| 163 | 163 | $document['links'] = $this->links; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if (! empty($this->data)) { |
|
| 166 | + if (!empty($this->data)) { |
|
| 167 | 167 | $document['data'] = $this->data->toArray(); |
| 168 | 168 | |
| 169 | 169 | $resources = $this->getIncluded($this->data); |
@@ -175,15 +175,15 @@ discard block |
||
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - if (! empty($this->meta)) { |
|
| 178 | + if (!empty($this->meta)) { |
|
| 179 | 179 | $document['meta'] = $this->meta; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - if (! empty($this->errors)) { |
|
| 182 | + if (!empty($this->errors)) { |
|
| 183 | 183 | $document['errors'] = $this->errors; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - if (! empty($this->jsonapi)) { |
|
| 186 | + if (!empty($this->jsonapi)) { |
|
| 187 | 187 | $document['jsonapi'] = $this->jsonapi; |
| 188 | 188 | } |
| 189 | 189 | |
@@ -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 | |
@@ -98,7 +98,7 @@ discard block |
||
| 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 | |
@@ -124,6 +124,6 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | $queryString = http_build_query($queryParams); |
| 126 | 126 | |
| 127 | - $this->addLink($name, $url.($queryString ? '?'.$queryString : '')); |
|
| 127 | + $this->addLink($name, $url . ($queryString ? '?' . $queryString : '')); |
|
| 128 | 128 | } |
| 129 | 129 | } |
@@ -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 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $invalid = array_diff($relationships, $available); |
| 44 | 44 | |
| 45 | 45 | if (count($invalid)) { |
| 46 | - throw new InvalidParameterException('Invalid includes ['.implode(',', $invalid).']'); |
|
| 46 | + throw new InvalidParameterException('Invalid includes [' . implode(',', $invalid) . ']'); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | return $relationships; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | $invalid = array_diff(array_keys($sort), $available); |
| 138 | 138 | |
| 139 | 139 | if (count($invalid)) { |
| 140 | - throw new InvalidParameterException('Invalid sort fields ['.implode(',', $invalid).']'); |
|
| 140 | + throw new InvalidParameterException('Invalid sort fields [' . implode(',', $invalid) . ']'); |
|
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | { |
| 154 | 154 | $fields = $this->getInput('fields'); |
| 155 | 155 | |
| 156 | - if (! is_array($fields)) { |
|
| 156 | + if (!is_array($fields)) { |
|
| 157 | 157 | return []; |
| 158 | 158 | } |
| 159 | 159 | |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | if (method_exists($this, $name)) { |
| 61 | 61 | $relationship = $this->$name($model); |
| 62 | 62 | |
| 63 | - if ($relationship !== null && ! ($relationship instanceof Relationship)) { |
|
| 63 | + if ($relationship !== null && !($relationship instanceof Relationship)) { |
|
| 64 | 64 | throw new LogicException('Relationship method must return null or an instance of ' |
| 65 | 65 | .Relationship::class); |
| 66 | 66 | } |
@@ -84,10 +84,10 @@ |
||
| 84 | 84 | */ |
| 85 | 85 | private function getRelationshipMethodName($name) |
| 86 | 86 | { |
| 87 | - if (stripos($name, '-')) { |
|
| 88 | - $name = lcfirst(implode('', array_map('ucfirst', explode('-', $name)))); |
|
| 89 | - } |
|
| 87 | + if (stripos($name, '-')) { |
|
| 88 | + $name = lcfirst(implode('', array_map('ucfirst', explode('-', $name)))); |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - return $name; |
|
| 91 | + return $name; |
|
| 92 | 92 | } |
| 93 | 93 | } |
@@ -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 | |
@@ -81,26 +81,26 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | $links = []; |
| 84 | - if (! empty($this->links)) { |
|
| 84 | + if (!empty($this->links)) { |
|
| 85 | 85 | $links = $this->links; |
| 86 | 86 | } |
| 87 | 87 | $serializerLinks = $this->serializer->getLinks($this->data); |
| 88 | - if (! empty($serializerLinks)) { |
|
| 88 | + if (!empty($serializerLinks)) { |
|
| 89 | 89 | $links = array_merge($serializerLinks, $links); |
| 90 | 90 | } |
| 91 | - if (! empty($links)) { |
|
| 91 | + if (!empty($links)) { |
|
| 92 | 92 | $array['links'] = $links; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | $meta = []; |
| 96 | - if (! empty($this->meta)) { |
|
| 96 | + if (!empty($this->meta)) { |
|
| 97 | 97 | $meta = $this->meta; |
| 98 | 98 | } |
| 99 | 99 | $serializerMeta = $this->serializer->getMeta(); |
| 100 | - if (! empty($serializerMeta)) { |
|
| 100 | + if (!empty($serializerMeta)) { |
|
| 101 | 101 | $meta = array_merge($serializerMeta, $meta); |
| 102 | 102 | } |
| 103 | - if (! empty($meta)) { |
|
| 103 | + if (!empty($meta)) { |
|
| 104 | 104 | $array['meta'] = $meta; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | public function isIdentifier() |
| 117 | 117 | { |
| 118 | - return ! is_object($this->data) && ! is_array($this->data); |
|
| 118 | + return !is_object($this->data) && !is_array($this->data); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | 'id' => $this->getId() |
| 129 | 129 | ]; |
| 130 | 130 | |
| 131 | - if (! empty($this->meta)) { |
|
| 131 | + if (!empty($this->meta)) { |
|
| 132 | 132 | $array['meta'] = $this->meta; |
| 133 | 133 | } |
| 134 | 134 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public function getId() |
| 154 | 154 | { |
| 155 | - if (! is_object($this->data) && ! is_array($this->data)) { |
|
| 155 | + if (!is_object($this->data) && !is_array($this->data)) { |
|
| 156 | 156 | return (string) $this->data; |
| 157 | 157 | } |
| 158 | 158 | |