diff --git a/src/Contracts/FractalBuilder.php b/src/Contracts/FractalBuilder.php index 5a5b994..c2440b7 100644 --- a/src/Contracts/FractalBuilder.php +++ b/src/Contracts/FractalBuilder.php @@ -9,7 +9,7 @@ interface FractalBuilder { - + /** * Sets the meta data to add to the serialized data. * @@ -32,7 +32,6 @@ public function setMeta(array $meta); */ public function setTransformer($transformer); - /** * Sets the resource key to use for serializing data. * @@ -44,13 +43,12 @@ public function setTransformer($transformer); */ public function setResourceKey(string $resourceKey); - /** * Sets the paginator to use for serializing data. * Only applicable for collections. * * @param PaginatorInterface $paginator - * + * * @throws \InvalidArgumentException * * @return $this @@ -59,13 +57,12 @@ public function setResourceKey(string $resourceKey); */ public function setPaginator(PaginatorInterface $paginator); - /** * Sets the cursor to use for serializing data. * Only applicable for collections. * * @param CursorInterface $cursor - * + * * @throws \InvalidArgumentException * * @return $this @@ -74,7 +71,6 @@ public function setPaginator(PaginatorInterface $paginator); */ public function setCursor(CursorInterface $cursor); - /** * Sets the serializer to use for serializing data. * @@ -86,7 +82,6 @@ public function setCursor(CursorInterface $cursor); */ public function setSerializer(SerializerAbstract $serializer); - /** * Returns the data as an array, serializing it first if necessary. * @@ -94,7 +89,6 @@ public function setSerializer(SerializerAbstract $serializer); */ public function toArray(): array; - /** * Returns the data as a JSON string, serializing it first if necessary. * diff --git a/src/Contracts/FractalService.php b/src/Contracts/FractalService.php index e7aaf42..311268a 100644 --- a/src/Contracts/FractalService.php +++ b/src/Contracts/FractalService.php @@ -19,7 +19,6 @@ interface FractalService */ public function item($data, $transformer = null, ?string $resourceKey = null); - /** * Serializes a collection of items. * @@ -31,25 +30,23 @@ public function item($data, $transformer = null, ?string $resourceKey = null); */ public function collection($data, $transformer = null, ?string $resourceKey = null); - /** * Parses includes from either a string (GET query parameter) or an array * and stores them so that they are available at the time of serialization. * * @param string|array $includes - * + * * @return $this * * @see http://fractal.thephpleague.com/transformers#including-data */ public function parseIncludes($includes); - /** * Sets the default serializer to use for serializing data. * * @param SerializerAbstract $serializer - * + * * @return $this * * @see http://fractal.thephpleague.com/serializers/ diff --git a/src/FractalBuilder.php b/src/FractalBuilder.php index 367fa35..39c4217 100644 --- a/src/FractalBuilder.php +++ b/src/FractalBuilder.php @@ -69,7 +69,6 @@ class FractalBuilder implements FractalBuilderContract Item::class, ]; - /** * FractalBuilder constructor. * @@ -80,12 +79,11 @@ class FractalBuilder implements FractalBuilderContract public function __construct(Manager $fractal, string $resourceClass, $data) { $this->fractal = $fractal; - $this->data = $data; + $this->data = $data; $this->setResourceClass($resourceClass); } - /** * @inheritdoc */ @@ -96,7 +94,6 @@ public function setMeta(array $meta) return $this; } - /** * @inheritdoc */ @@ -107,7 +104,6 @@ public function setTransformer($transformer) return $this; } - /** * @inheritdoc */ @@ -118,7 +114,6 @@ public function setResourceKey(string $resourceKey) return $this; } - /** * @inheritdoc */ @@ -133,7 +128,6 @@ public function setPaginator(PaginatorInterface $paginator) return $this; } - /** * @inheritdoc */ @@ -148,7 +142,6 @@ public function setCursor(CursorInterface $cursor) return $this; } - /** * @inheritdoc */ @@ -159,7 +152,6 @@ public function setSerializer(SerializerAbstract $serializer) return $this; } - /** * @inheritdoc */ @@ -168,7 +160,6 @@ public function toArray(): array return $this->makeScope()->toArray(); } - /** * @inheritdoc */ @@ -177,7 +168,6 @@ public function toJson(): string return $this->makeScope()->toJson(); } - /** * Creates the resource for this builder. * @@ -199,7 +189,6 @@ protected function makeResource(): ResourceAbstract return $resource; } - /** * Creates the scope for this builder. * @@ -215,12 +204,12 @@ protected function makeScope(): Scope return $this->fractal->createData($resource); } - + /** * @param string $resourceClass * * @return $this - * + * * @throws \InvalidArgumentException */ private function setResourceClass(string $resourceClass) @@ -230,7 +219,7 @@ private function setResourceClass(string $resourceClass) } $this->resourceClass = $resourceClass; - + return $this; } } diff --git a/src/FractalMiddleware.php b/src/FractalMiddleware.php index e8e1faa..2f13c83 100644 --- a/src/FractalMiddleware.php +++ b/src/FractalMiddleware.php @@ -13,7 +13,6 @@ class FractalMiddleware */ private $service; - /** * FractalMiddleware constructor. * @@ -24,7 +23,6 @@ public function __construct(FractalService $service) $this->service = $service; } - /** * Run the request filter. * diff --git a/src/FractalService.php b/src/FractalService.php index d1c1359..f85d38b 100644 --- a/src/FractalService.php +++ b/src/FractalService.php @@ -22,7 +22,6 @@ class FractalService implements FractalServiceContract */ private $defaultSerializer; - /** * @inheritdoc */ @@ -31,7 +30,6 @@ public function item($data, $transformer = null, ?string $resourceKey = null) return $this->makeBuilder(Item::class, $data, $transformer, $resourceKey); } - /** * @inheritdoc */ @@ -40,7 +38,6 @@ public function collection($data, $transformer = null, ?string $resourceKey = nu return $this->makeBuilder(Collection::class, $data, $transformer, $resourceKey); } - /** * @inheritdoc */ @@ -51,34 +48,36 @@ public function parseIncludes($includes) } $this->includes = array_merge($this->includes, $includes); - + return $this; } - /** * @inheritdoc */ public function setDefaultSerializer(SerializerAbstract $serializer) { $this->defaultSerializer = $serializer; - + return $this; } - /** * Creates a builder for serializing data. * - * @param string $resourceClass - * @param mixed $data + * @param string $resourceClass + * @param mixed $data * @param TransformerAbstract|callable|null $transformer - * @param string|null $resourceKey + * @param string|null $resourceKey * * @return FractalBuilder */ - protected function makeBuilder(string $resourceClass, $data, $transformer = null, string $resourceKey = null): FractalBuilder - { + protected function makeBuilder( + string $resourceClass, + $data, + $transformer = null, + string $resourceKey = null + ): FractalBuilder { $fractal = $this->makeFractal(); $builder = new FractalBuilder($fractal, $resourceClass, $data); @@ -93,7 +92,6 @@ protected function makeBuilder(string $resourceClass, $data, $transformer = null return $builder; } - /** * @return Manager */ diff --git a/src/FractalServiceProvider.php b/src/FractalServiceProvider.php index 6518dba..7498811 100644 --- a/src/FractalServiceProvider.php +++ b/src/FractalServiceProvider.php @@ -9,7 +9,6 @@ class FractalServiceProvider extends ServiceProvider { - private const CONFIG_KEY = 'fractal'; /**