1 | <?php |
||
8 | class CollectionSerializer extends JsonApiSerializer |
||
9 | { |
||
10 | /** |
||
11 | * The collection of records to transform. |
||
12 | * |
||
13 | * @var \Illuminate\Support\Collection |
||
14 | */ |
||
15 | protected $records; |
||
16 | |||
17 | /** |
||
18 | * The subset of attributes to return on each record type. |
||
19 | * |
||
20 | * @var array |
||
21 | */ |
||
22 | protected $fields; |
||
23 | |||
24 | /** |
||
25 | * The relationships to load and include. |
||
26 | * |
||
27 | * @var array |
||
28 | */ |
||
29 | protected $include; |
||
30 | |||
31 | /** |
||
32 | * Create a new JSON API collection serializer. |
||
33 | * |
||
34 | * @param \Illuminate\Support\Collection|LengthAwarePaginator $records The collection of records to serialize |
||
35 | * @param array|null $fields Subset of fields to return by record type |
||
36 | * @param array|null $include Relations to include |
||
37 | */ |
||
38 | public function __construct($records, array $fields = [], array $include = []) |
||
53 | |||
54 | /** |
||
55 | * Return a collection of JSON API resource objects for the record set. |
||
56 | * |
||
57 | * @return \Illuminate\Support\Collection |
||
58 | */ |
||
59 | public function toResourceCollection() |
||
65 | |||
66 | /** |
||
67 | * Return primary data for the JSON API document. |
||
68 | * |
||
69 | * @return mixed |
||
70 | */ |
||
71 | protected function getPrimaryData() |
||
75 | |||
76 | /** |
||
77 | * Return any secondary included resource objects. |
||
78 | * |
||
79 | * @throws \Huntie\JsonApi\Exceptions\InvalidRelationPathException |
||
80 | * |
||
81 | * @return \Illuminate\Support\Collection |
||
82 | */ |
||
83 | public function getIncluded() |
||
96 | |||
97 | /** |
||
98 | * Add pagination links and meta information to the main document. |
||
99 | * |
||
100 | * @param LengthAwarePaginator $paginator |
||
101 | */ |
||
102 | protected function addPaginationLinks($paginator) |
||
117 | } |
||
118 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.