1 | <?php |
||
21 | class ResourceFactory implements ResourceFactoryContract |
||
22 | { |
||
23 | /** |
||
24 | * A service class, used to normalize data. |
||
25 | * |
||
26 | * @var \Flugg\Responder\DataNormalizer |
||
27 | */ |
||
28 | protected $normalizer; |
||
29 | |||
30 | /** |
||
31 | * A manager class, used to manage transformers. |
||
32 | * |
||
33 | * @var \Flugg\Responder\Contracts\Transformers\TransformerResolver |
||
34 | */ |
||
35 | protected $transformerResolver; |
||
36 | |||
37 | /** |
||
38 | * Construct the factory class. |
||
39 | * |
||
40 | * @param \Flugg\Responder\Resources\DataNormalizer $normalizer |
||
41 | * @param \Flugg\Responder\Contracts\Transformers\TransformerResolver $transformerResolver |
||
42 | */ |
||
43 | 6 | public function __construct(DataNormalizer $normalizer, TransformerResolver $transformerResolver) |
|
48 | |||
49 | /** |
||
50 | * Make resource from the given data. |
||
51 | * |
||
52 | * @param mixed $data |
||
53 | * @param \Flugg\Responder\Transformers\Transformer|string|callable|null $transformer |
||
54 | * @param string|null $resourceKey |
||
55 | * @return \League\Fractal\Resource\ResourceInterface |
||
56 | */ |
||
57 | 6 | public function make($data = null, $transformer = null, string $resourceKey = null): ResourceInterface |
|
69 | |||
70 | /** |
||
71 | * Resolve a transformer. |
||
72 | * |
||
73 | * @param mixed $data |
||
74 | * @param \Flugg\Responder\Transformers\Transformer|string|callable|null $transformer |
||
75 | * @return \Flugg\Responder\Transformers\Transformer|callable |
||
76 | */ |
||
77 | 5 | protected function resolveTransformer($data, $transformer) |
|
85 | |||
86 | /** |
||
87 | * Instatiate a new resource instance. |
||
88 | * |
||
89 | * @param mixed $data |
||
90 | * @param \Flugg\Responder\Transformers\Transformer|callable|null $transformer |
||
91 | * @param string|null $resourceKey |
||
92 | * @return \League\Fractal\Resource\ResourceInterface |
||
93 | */ |
||
94 | 5 | protected function instatiateResource($data, $transformer = null, string $resourceKey = null): ResourceInterface |
|
104 | |||
105 | /** |
||
106 | * Indicates if the data belongs to a collection resource. |
||
107 | * |
||
108 | * @param mixed $data |
||
109 | * @return bool |
||
110 | */ |
||
111 | 4 | protected function shouldCreateCollection($data): bool |
|
119 | } |
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..