1 | <?php |
||
30 | class AlertTransformer extends TransformerAbstract |
||
31 | { |
||
32 | /** |
||
33 | * List of available includes to this resource |
||
34 | * |
||
35 | * @var array |
||
36 | */ |
||
37 | protected $availableIncludes = [ |
||
38 | 'classes', |
||
39 | 'combatHistorys', |
||
40 | 'combats', |
||
41 | 'mapInitials', |
||
42 | 'maps', |
||
43 | 'outfits', |
||
44 | 'players', |
||
45 | 'populations', |
||
46 | 'vehicles', |
||
47 | 'weapons', |
||
48 | 'xps' |
||
49 | ]; |
||
50 | |||
51 | /** |
||
52 | * Repositories |
||
53 | */ |
||
54 | protected $classRepo; |
||
55 | protected $combatHistoryRepo; |
||
56 | protected $combatRepo; |
||
57 | protected $mapInitialRepo; |
||
58 | protected $mapRepo; |
||
59 | protected $outfitRepo; |
||
60 | protected $playerRepo; |
||
61 | protected $populationRepo; |
||
62 | protected $vehicleRepo; |
||
63 | protected $weaponRepo; |
||
64 | protected $xpRepo; |
||
65 | |||
66 | /** |
||
67 | * Constructor |
||
68 | * |
||
69 | * @param ClassRepository $classRepo |
||
70 | * @param CombatHistoryRepository $combatHistoryRepo |
||
71 | * @param CombatRepository $combatRepo |
||
72 | * @param MapInitialRepository $mapInitialRepo |
||
73 | * @param MapRepository $mapRepo |
||
74 | * @param OutfitRepository $outfitRepo |
||
75 | * @param PlayerRepository $playerRepo |
||
76 | * @param PopulationRepository $populationRepo |
||
77 | * @param VehicleRepository $vehicleRepo |
||
78 | * @param WeaponRepository $weaponRepo |
||
79 | * @param XpRepository $xpRepo |
||
80 | */ |
||
81 | public function __construct( |
||
82 | ClassRepository $classRepo, |
||
83 | CombatHistoryRepository $combatHistoryRepo, |
||
84 | CombatRepository $combatRepo, |
||
85 | MapInitialRepository $mapInitialRepo, |
||
86 | MapRepository $mapRepo, |
||
87 | OutfitRepository $outfitRepo, |
||
88 | PlayerRepository $playerRepo, |
||
89 | PopulationRepository $populationRepo, |
||
90 | VehicleRepository $vehicleRepo, |
||
91 | WeaponRepository $weaponRepo, |
||
92 | XpRepository $xpRepo |
||
93 | ) { |
||
94 | $this->classRepo = $classRepo; |
||
95 | $this->combatHistoryRepo = $combatHistoryRepo; |
||
96 | $this->combatRepo = $combatRepo; |
||
97 | $this->mapInitialRepo = $mapInitialRepo; |
||
98 | $this->mapRepo = $mapRepo; |
||
99 | $this->outfitRepo = $outfitRepo; |
||
100 | $this->playerRepo = $playerRepo; |
||
101 | $this->populationRepo = $populationRepo; |
||
102 | $this->vehicleRepo = $vehicleRepo; |
||
103 | $this->weaponRepo = $weaponRepo; |
||
104 | $this->xpRepo = $xpRepo; |
||
105 | } |
||
106 | |||
107 | /** |
||
108 | * The tranform method required by Fractal to parse the data and return proper typing and fields. |
||
109 | * |
||
110 | * @param array $data Data to transform |
||
111 | * |
||
112 | * @return array |
||
113 | */ |
||
114 | public function transform($data) |
||
129 | |||
130 | /** |
||
131 | * Gets the Class data and then adds it to the result |
||
132 | * |
||
133 | * @param array $data |
||
134 | * |
||
135 | * @return \League\Fractal\Resource\Collection |
||
136 | */ |
||
137 | public function includeClasses($data) |
||
142 | |||
143 | /** |
||
144 | * Gets the Combat History data and then adds it to the result |
||
145 | * |
||
146 | * @param array $data |
||
147 | * |
||
148 | * @return \League\Fractal\Resource\Collection |
||
149 | */ |
||
150 | public function includeCombatHistorys($data) |
||
155 | |||
156 | /** |
||
157 | * Gets the Combat data and then adds it to the result |
||
158 | * |
||
159 | * @param array $data |
||
160 | * |
||
161 | * @return \League\Fractal\Resource\Item |
||
162 | */ |
||
163 | public function includeCombats($data) |
||
164 | { |
||
165 | $data = $this->combatRepo->readSingleById($data['ResultID'], 'result'); |
||
166 | return $this->item($data, new CombatTransformer); |
||
167 | } |
||
168 | |||
169 | /** |
||
170 | * Gets the Class data and then adds it to the result |
||
171 | * |
||
172 | * @param array $data |
||
173 | * |
||
174 | * @return \League\Fractal\Resource\Collection |
||
175 | */ |
||
176 | public function includeMapInitials($data) |
||
181 | |||
182 | /** |
||
183 | * Gets the Map data and then adds it to the result |
||
184 | * |
||
185 | * @param array $data |
||
186 | * |
||
187 | * @return \League\Fractal\Resource\Collection |
||
188 | */ |
||
189 | public function includeMaps($data) |
||
194 | |||
195 | /** |
||
196 | * Gets the Outfit data and then adds it to the result |
||
197 | * |
||
198 | * @param array $data |
||
199 | * |
||
200 | * @return \League\Fractal\Resource\Collection |
||
201 | */ |
||
202 | public function includeOutfits($data) |
||
207 | |||
208 | /** |
||
209 | * Gets the Popualtion data and then adds it to the result |
||
210 | * |
||
211 | * @param array $data |
||
212 | * |
||
213 | * @return \League\Fractal\Resource\Collection |
||
214 | */ |
||
215 | public function includePopulations($data) |
||
220 | |||
221 | /** |
||
222 | * Gets the Player data and then adds it to the result |
||
223 | * |
||
224 | * @param array $data |
||
225 | * |
||
226 | * @return \League\Fractal\Resource\Collection |
||
227 | */ |
||
228 | public function includePlayers($data) |
||
233 | |||
234 | /** |
||
235 | * Gets the Vehicle data and then adds it to the result |
||
236 | * |
||
237 | * @param array $data |
||
238 | * |
||
239 | * @return \League\Fractal\Resource\Collection |
||
240 | */ |
||
241 | public function includeVehicles($data) |
||
246 | |||
247 | /** |
||
248 | * Gets the Weapon data and then adds it to the result |
||
249 | * |
||
250 | * @param array $data |
||
251 | * |
||
252 | * @return \League\Fractal\Resource\Collection |
||
253 | */ |
||
254 | public function includeWeapons($data) |
||
259 | |||
260 | /** |
||
261 | * Gets the XP data and then adds it to the result |
||
262 | * |
||
263 | * @param array $data |
||
264 | * |
||
265 | * @return \League\Fractal\Resource\Collection |
||
266 | */ |
||
267 | public function includeXps($data) |
||
273 | } |
||
274 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: