1 | <?php |
||
5 | class JsonApiSerializer |
||
6 | { |
||
7 | /** |
||
8 | * The model instance to transform. |
||
9 | * |
||
10 | * @var \Illuminate\Database\Eloquent\Model |
||
11 | */ |
||
12 | protected $record; |
||
13 | |||
14 | /** |
||
15 | * The subset of record attributes to return. |
||
16 | * |
||
17 | * @var array |
||
18 | */ |
||
19 | protected $fields; |
||
20 | |||
21 | /** |
||
22 | * The record relations to include. |
||
23 | * |
||
24 | * @var array |
||
25 | */ |
||
26 | protected $include; |
||
27 | |||
28 | /** |
||
29 | * Meta information to include. |
||
30 | * |
||
31 | * @var \Illuminate\Support\Collection |
||
32 | */ |
||
33 | protected $meta; |
||
34 | |||
35 | /** |
||
36 | * Resource links to include. |
||
37 | * |
||
38 | * @var \Illuminate\Support\Collection |
||
39 | */ |
||
40 | protected $links; |
||
41 | |||
42 | /** |
||
43 | * The loaded records to include. |
||
44 | * |
||
45 | * @var \Illuminate\Support\Collection |
||
46 | */ |
||
47 | protected $included; |
||
48 | |||
49 | /** |
||
50 | * Create a new JSON API resource serializer. |
||
51 | * |
||
52 | * @param Model $record The model instance to serialise |
||
53 | * @param array|null $fields Subset of fields to return |
||
54 | * @param array|null $include Relations to include |
||
55 | */ |
||
56 | public function __construct($record, array $fields = [], array $include = []) |
||
65 | |||
66 | /** |
||
67 | * Limit which relations can be included. |
||
68 | * |
||
69 | * @param array $include |
||
70 | */ |
||
71 | public function scopeIncludes($include) |
||
75 | |||
76 | /** |
||
77 | * Add meta information to the returned object. |
||
78 | * |
||
79 | * @param string|array $key |
||
80 | * @param string|int|null $value |
||
81 | */ |
||
82 | public function addMeta($key, $value = null) |
||
86 | |||
87 | /** |
||
88 | * Add one or more links to the returned object. |
||
89 | * |
||
90 | * @param string|array $key |
||
91 | * @param string|int|null $value |
||
92 | */ |
||
93 | public function addLinks($key, $value = null) |
||
97 | |||
98 | /** |
||
99 | * Return a JSON API resource object for the primary record. |
||
100 | * |
||
101 | * @return array |
||
102 | */ |
||
103 | public function toResourceObject() |
||
109 | |||
110 | /** |
||
111 | * Return a JSON API resource identifier object for the primary record. |
||
112 | * |
||
113 | * @return array |
||
114 | */ |
||
115 | public function toResourceIdentifier() |
||
122 | |||
123 | /** |
||
124 | * Serialise complete JSON API document to an array. |
||
125 | * |
||
126 | * @return array |
||
127 | */ |
||
128 | public function serialiseToObject() |
||
137 | |||
138 | /** |
||
139 | * Serialise complete JSON API document to a JSON string. |
||
140 | * |
||
141 | * @return array |
||
142 | */ |
||
143 | public function serializeToJson() |
||
147 | |||
148 | /** |
||
149 | * Return the primary record type name. |
||
150 | * |
||
151 | * @return string |
||
152 | */ |
||
153 | protected function getRecordType() |
||
157 | } |
||
158 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..