Passed
Pull Request — main (#73)
by Lode
14:32 queued 11:45
created
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.
src/objects/ResourceIdentifierObject.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @param string     $type optional
32 32
 	 * @param string|int $id   optional
33 33
 	 */
34
-	public function __construct($type=null, $id=null) {
34
+	public function __construct($type = null, $id = null) {
35 35
 		$this->validator = new Validator();
36 36
 		
37 37
 		if ($type !== null) {
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 		}
43 43
 		
44 44
 		// always mark as used, as these keys are reserved
45
-		$this->validator->claimUsedFields($fieldNames=['type'], Validator::OBJECT_CONTAINER_TYPE);
46
-		$this->validator->claimUsedFields($fieldNames=['id'], Validator::OBJECT_CONTAINER_ID);
47
-		$this->validator->claimUsedFields($fieldNames=['lid'], Validator::OBJECT_CONTAINER_LID);
45
+		$this->validator->claimUsedFields($fieldNames = ['type'], Validator::OBJECT_CONTAINER_TYPE);
46
+		$this->validator->claimUsedFields($fieldNames = ['id'], Validator::OBJECT_CONTAINER_ID);
47
+		$this->validator->claimUsedFields($fieldNames = ['lid'], Validator::OBJECT_CONTAINER_LID);
48 48
 	}
49 49
 	
50 50
 	/**
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	/**
220 220
 	 * @inheritDoc
221 221
 	 */
222
-	public function getResource($identifierOnly=false) {
222
+	public function getResource($identifierOnly = false) {
223 223
 		return $this;
224 224
 	}
225 225
 	
Please login to merge, or discard this patch.