diff --git a/src/Serializer/JsonApiSerializer.php b/src/Serializer/JsonApiSerializer.php index 10d5cb4e..1bf91b54 100644 --- a/src/Serializer/JsonApiSerializer.php +++ b/src/Serializer/JsonApiSerializer.php @@ -13,7 +13,6 @@ use InvalidArgumentException; use League\Fractal\Resource\ResourceInterface; -use League\Fractal\Resource\ResourceAbstract; class JsonApiSerializer extends ArraySerializer { @@ -188,7 +187,7 @@ public function filterIncludes($includedData, $data) * * @return bool */ - private function filterRootObject($object) + protected function filterRootObject($object) { return !$this->isRootObject($object); } @@ -198,7 +197,7 @@ private function filterRootObject($object) * * @param array $objects */ - private function setRootObjects(array $objects = []) + protected function setRootObjects(array $objects = []) { $this->rootObjects = array_map(function($object) { return "{$object['type']}:{$object['id']}"; @@ -212,28 +211,28 @@ private function setRootObjects(array $objects = []) * * @return bool */ - private function isRootObject($object) + protected function isRootObject($object) { $objectKey = "{$object['type']}:{$object['id']}"; return in_array($objectKey, $this->rootObjects); } - private function isCollection($data) + protected function isCollection($data) { return array_key_exists('data', $data) && array_key_exists(0, $data['data']); } - private function isNull($data) + protected function isNull($data) { return array_key_exists('data', $data) && $data['data'] === null; } - private function isEmpty($data) { + protected function isEmpty($data) { return array_key_exists('data', $data) && $data['data'] === []; } - private function fillRelationships($data, $relationships) + protected function fillRelationships($data, $relationships) { if ($this->isCollection($data)) { foreach ($relationships as $key => $relationship) { @@ -260,7 +259,7 @@ private function fillRelationships($data, $relationships) return $data; } - private function parseRelationships($includedData) + protected function parseRelationships($includedData) { $relationships = []; @@ -305,7 +304,7 @@ private function parseRelationships($includedData) return $relationships; } - private function getIdFromData(array $data) + protected function getIdFromData(array $data) { if (!array_key_exists('id', $data)) { throw new InvalidArgumentException( @@ -323,7 +322,7 @@ private function getIdFromData(array $data) * * @return array */ - private function pullOutNestedIncludedData(ResourceInterface $resource, array $data) + protected function pullOutNestedIncludedData(ResourceInterface $resource, array $data) { $includedData = []; $linkedIds = []; @@ -353,7 +352,7 @@ private function pullOutNestedIncludedData(ResourceInterface $resource, array $d * * @return bool */ - private function shouldIncludeLinks() + protected function shouldIncludeLinks() { return $this->baseUrl !== null; }