Test Failed
Pull Request — main (#71)
by Lode
07:53 queued 05:10
created
src/objects/RelationshipObject.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @throws InputException if $type is unknown
36 36
 	 */
37 37
 	public function __construct($type) {
38
-		if (in_array($type, [RelationshipObject::TO_ONE, RelationshipObject::TO_MANY], $strict=true) === false) {
38
+		if (in_array($type, [RelationshipObject::TO_ONE, RelationshipObject::TO_MANY], $strict = true) === false) {
39 39
 			throw new InputException('unknown relationship type "'.$type.'"');
40 40
 		}
41 41
 		
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * 
57 57
 	 * @throws InputException if $relation is not one of the supported formats
58 58
 	 */
59
-	public static function fromAnything($relation, array $links=[], array $meta=[]) {
59
+	public static function fromAnything($relation, array $links = [], array $meta = []) {
60 60
 		if (is_array($relation)) {
61 61
 			$relation = CollectionDocument::fromResources(...$relation);
62 62
 		}
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * @param  string            $type     optional, one of the RelationshipObject::TO_* constants, defaults to RelationshipObject::TO_ONE
85 85
 	 * @return RelationshipObject
86 86
 	 */
87
-	public static function fromResource(ResourceInterface $resource, array $links=[], array $meta=[], $type=RelationshipObject::TO_ONE) {
87
+	public static function fromResource(ResourceInterface $resource, array $links = [], array $meta = [], $type = RelationshipObject::TO_ONE) {
88 88
 		$relationshipObject = new self($type);
89 89
 		
90 90
 		if ($type === RelationshipObject::TO_ONE) {
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @param  array              $meta               optional
111 111
 	 * @return RelationshipObject
112 112
 	 */
113
-	public static function fromCollectionDocument(CollectionDocument $collectionDocument, array $links=[], array $meta=[]) {
113
+	public static function fromCollectionDocument(CollectionDocument $collectionDocument, array $links = [], array $meta = []) {
114 114
 		$relationshipObject = new self(RelationshipObject::TO_MANY);
115 115
 		
116 116
 		foreach ($collectionDocument->getContainedResources() as $resource) {
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 * @param string $href
132 132
 	 * @param array  $meta optional, if given a LinkObject is added, otherwise a link string is added
133 133
 	 */
134
-	public function setSelfLink($href, array $meta=[]) {
134
+	public function setSelfLink($href, array $meta = []) {
135 135
 		$this->addLink('self', $href, $meta);
136 136
 	}
137 137
 	
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 * @param string $href
140 140
 	 * @param array  $meta optional, if given a LinkObject is added, otherwise a link string is added
141 141
 	 */
142
-	public function setRelatedLink($href, array $meta=[]) {
142
+	public function setRelatedLink($href, array $meta = []) {
143 143
 		$this->addLink('related', $href, $meta);
144 144
 	}
145 145
 	
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * 
149 149
 	 * @throws InputException if used on a to-one relationship
150 150
 	 */
151
-	public function setPaginationLinks($previousHref=null, $nextHref=null, $firstHref=null, $lastHref=null) {
151
+	public function setPaginationLinks($previousHref = null, $nextHref = null, $firstHref = null, $lastHref = null) {
152 152
 		if ($this->type === RelationshipObject::TO_ONE) {
153 153
 			throw new InputException('can not add pagination links to a to-one relationship');
154 154
 		}
@@ -289,13 +289,13 @@  discard block
 block discarded – undo
289 289
 		if ($this->type === RelationshipObject::TO_ONE) {
290 290
 			$array['data'] = null;
291 291
 			if ($this->resource !== null) {
292
-				$array['data'] = $this->resource->getResource($identifierOnly=true)->toArray();
292
+				$array['data'] = $this->resource->getResource($identifierOnly = true)->toArray();
293 293
 			}
294 294
 		}
295 295
 		if ($this->type === RelationshipObject::TO_MANY) {
296 296
 			$array['data'] = [];
297 297
 			foreach ($this->resources as $resource) {
298
-				$array['data'][] = $resource->getResource($identifierOnly=true)->toArray();
298
+				$array['data'][] = $resource->getResource($identifierOnly = true)->toArray();
299 299
 			}
300 300
 		}
301 301
 		if ($this->meta !== null && $this->meta->isEmpty() === false) {
Please login to merge, or discard this patch.
src/objects/RelationshipsObject.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 	 * @param  array  $meta     optional
29 29
 	 * @return RelationshipObject
30 30
 	 */
31
-	public function add($key, $relation, array $links=[], array $meta=[]) {
31
+	public function add($key, $relation, array $links = [], array $meta = []) {
32 32
 		$relationshipObject = RelationshipObject::fromAnything($relation, $links, $meta);
33 33
 		
34 34
 		$this->addRelationshipObject($key, $relationshipObject);
Please login to merge, or discard this patch.
src/objects/LinksObject.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @param string $href
50 50
 	 * @param array  $meta optional, if given a LinkObject is added, otherwise a link string is added
51 51
 	 */
52
-	public function add($key, $href, array $meta=[]) {
52
+	public function add($key, $href, array $meta = []) {
53 53
 		if ($meta === []) {
54 54
 			$this->addLinkString($key, $href);
55 55
 		}
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * 
70 70
 	 * @throws DuplicateException if another link is already using that $key but is not an array
71 71
 	 */
72
-	public function append($key, $href, array $meta=[]) {
72
+	public function append($key, $href, array $meta = []) {
73 73
 		Validator::checkMemberName($key);
74 74
 		
75 75
 		if (isset($this->links[$key]) === false) {
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -180,7 +180,8 @@
 block discarded – undo
180 180
 			elseif ($link instanceof LinkObject && $link->isEmpty()) {
181 181
 				$array[$key] = null;
182 182
 			}
183
-			else { // string or null
183
+			else {
184
+// string or null
184 185
 				$array[$key] = $link;
185 186
 			}
186 187
 		}
Please login to merge, or discard this patch.
src/objects/LinkObject.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 	 * @param string $href
19 19
 	 * @param array  $meta optional
20 20
 	 */
21
-	public function __construct($href=null, array $meta=[]) {
21
+	public function __construct($href = null, array $meta = []) {
22 22
 		if ($href !== null) {
23 23
 			$this->setHref($href);
24 24
 		}
Please login to merge, or discard this patch.
src/objects/JsonapiObject.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 	/**
19 19
 	 * @param string $version one of the Document::JSONAPI_VERSION_* constants, optional, defaults to Document::JSONAPI_VERSION_LATEST
20 20
 	 */
21
-	public function __construct($version=Document::JSONAPI_VERSION_LATEST) {
21
+	public function __construct($version = Document::JSONAPI_VERSION_LATEST) {
22 22
 		if ($version !== null) {
23 23
 			$this->setVersion($version);
24 24
 		}
Please login to merge, or discard this patch.
src/ResourceDocument.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 * @param string     $type optional
41 41
 	 * @param string|int $id   optional
42 42
 	 */
43
-	public function __construct($type=null, $id=null) {
43
+	public function __construct($type = null, $id = null) {
44 44
 		parent::__construct();
45 45
 		
46 46
 		$this->setPrimaryResource(new ResourceObject($type, $id));
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 * @param  array      $options    optional {@see ResourceDocument::$defaults} {@see ResourceObject::$defaults}
58 58
 	 * @return ResourceDocument
59 59
 	 */
60
-	public static function fromArray(array $attributes, $type=null, $id=null, array $options=[]) {
60
+	public static function fromArray(array $attributes, $type = null, $id = null, array $options = []) {
61 61
 		$resourceDocument = new self();
62 62
 		$resourceDocument->setPrimaryResource(ResourceObject::fromArray($attributes, $type, $id, $options), $options);
63 63
 		
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * @param  array      $options    optional {@see ResourceDocument::$defaults}
72 72
 	 * @return ResourceDocument
73 73
 	 */
74
-	public static function fromObject($attributes, $type=null, $id=null, array $options=[]) {
74
+	public static function fromObject($attributes, $type = null, $id = null, array $options = []) {
75 75
 		$array = Converter::objectToArray($attributes);
76 76
 		
77 77
 		return self::fromArray($array, $type, $id, $options);
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * @param mixed  $value   objects will be converted using `get_object_vars()`
85 85
 	 * @param array  $options optional {@see ResourceDocument::$defaults}
86 86
 	 */
87
-	public function add($key, $value, array $options=[]) {
87
+	public function add($key, $value, array $options = []) {
88 88
 		$this->ensureResourceObject();
89 89
 		
90 90
 		$this->resource->add($key, $value, $options);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * @param array   $meta     optional
102 102
 	 * @param array   $options  optional {@see ResourceDocument::$defaults}
103 103
 	 */
104
-	public function addRelationship($key, $relation, array $links=[], array $meta=[], array $options=[]) {
104
+	public function addRelationship($key, $relation, array $links = [], array $meta = [], array $options = []) {
105 105
 		$this->ensureResourceObject();
106 106
 		
107 107
 		$options = array_merge(self::$defaults, $options);
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * @param array  $meta optional, if given a LinkObject is added, otherwise a link string is added
120 120
 	 * @param string $level one of the Document::LEVEL_* constants, optional, defaults to Document::LEVEL_ROOT
121 121
 	 */
122
-	public function addLink($key, $href, array $meta=[], $level=Document::LEVEL_ROOT) {
122
+	public function addLink($key, $href, array $meta = [], $level = Document::LEVEL_ROOT) {
123 123
 		$this->ensureResourceObject();
124 124
 		
125 125
 		if ($level === Document::LEVEL_RESOURCE) {
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 * @param string $href
137 137
 	 * @param array  $meta optional
138 138
 	 */
139
-	public function setSelfLink($href, array $meta=[], $level=Document::LEVEL_RESOURCE) {
139
+	public function setSelfLink($href, array $meta = [], $level = Document::LEVEL_RESOURCE) {
140 140
 		$this->ensureResourceObject();
141 141
 		
142 142
 		if ($level === Document::LEVEL_RESOURCE) {
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 * @param mixed  $value
153 153
 	 * @param string $level one of the Document::LEVEL_* constants, optional, defaults to Document::LEVEL_ROOT
154 154
 	 */
155
-	public function addMeta($key, $value, $level=Document::LEVEL_ROOT) {
155
+	public function addMeta($key, $value, $level = Document::LEVEL_ROOT) {
156 156
 		if ($level === Document::LEVEL_RESOURCE) {
157 157
 			$this->resource->addMeta($key, $value);
158 158
 		}
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 * @param AttributesObject $attributesObject
184 184
 	 * @param array            $options          optional {@see ResourceObject::$defaults}
185 185
 	 */
186
-	public function setAttributesObject(AttributesObject $attributesObject, array $options=[]) {
186
+	public function setAttributesObject(AttributesObject $attributesObject, array $options = []) {
187 187
 		$this->ensureResourceObject();
188 188
 		
189 189
 		$this->resource->setAttributesObject($attributesObject, $options);
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 * @param RelationshipObject $relationshipObject
199 199
 	 * @param array              $options            optional {@see ResourceDocument::$defaults}
200 200
 	 */
201
-	public function addRelationshipObject($key, RelationshipObject $relationshipObject, array $options=[]) {
201
+	public function addRelationshipObject($key, RelationshipObject $relationshipObject, array $options = []) {
202 202
 		$this->ensureResourceObject();
203 203
 		
204 204
 		$options = array_merge(self::$defaults, $options);
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 * @param RelationshipsObject $relationshipsObject
219 219
 	 * @param array               $options             optional {@see ResourceDocument::$defaults}
220 220
 	 */
221
-	public function setRelationshipsObject(RelationshipsObject $relationshipsObject, array $options=[]) {
221
+	public function setRelationshipsObject(RelationshipsObject $relationshipsObject, array $options = []) {
222 222
 		$this->ensureResourceObject();
223 223
 		
224 224
 		$options = array_merge(self::$defaults, $options);
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 	 * 
245 245
 	 * @throws InputException if the $resource is a ResourceDocument itself
246 246
 	 */
247
-	public function setPrimaryResource(ResourceInterface $resource, array $options=[]) {
247
+	public function setPrimaryResource(ResourceInterface $resource, array $options = []) {
248 248
 		if ($resource instanceof ResourceDocument) {
249 249
 			throw new InputException('does not make sense to set a document inside a document, use ResourceObject or ResourceIdentifierObject instead');
250 250
 		}
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	/**
299 299
 	 * @inheritDoc
300 300
 	 */
301
-	public function getResource($identifierOnly=false) {
301
+	public function getResource($identifierOnly = false) {
302 302
 		return $this->resource->getResource($identifierOnly);
303 303
 	}
304 304
 }
Please login to merge, or discard this patch.
src/interfaces/PaginableInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,5 +9,5 @@
 block discarded – undo
9 9
 	 * @param string $firstHref    optional
10 10
 	 * @param string $lastHref     optional
11 11
 	 */
12
-	public function setPaginationLinks($previousHref=null, $nextHref=null, $firstHref=null, $lastHref=null);
12
+	public function setPaginationLinks($previousHref = null, $nextHref = null, $firstHref = null, $lastHref = null);
13 13
 }
Please login to merge, or discard this patch.
src/interfaces/ResourceInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,5 +12,5 @@
 block discarded – undo
12 12
 	 * @param  boolean $identifierOnly optional, defaults to false
13 13
 	 * @return ResourceIdentifierObject|ResourceObject
14 14
 	 */
15
-	public function getResource($identifierOnly=false);
15
+	public function getResource($identifierOnly = false);
16 16
 }
Please login to merge, or discard this patch.
src/interfaces/DocumentInterface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 * 
21 21
 	 * @throws Exception if generating json fails
22 22
 	 */
23
-	public function toJson(array $options=[]);
23
+	public function toJson(array $options = []);
24 24
 	
25 25
 	/**
26 26
 	 * send jsonapi response to the browser
@@ -29,5 +29,5 @@  discard block
 block discarded – undo
29 29
 	 * 
30 30
 	 * @param array $options optional
31 31
 	 */
32
-	public function sendResponse(array $options=[]);
32
+	public function sendResponse(array $options = []);
33 33
 }
Please login to merge, or discard this patch.