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 VehicleTotalRepository $vehicleRepo |
||
78 | * @param WeaponTotalRepository $weaponRepo |
||
79 | * @param XpRepository $xpRepo |
||
80 | */ |
||
81 | public function __construct( |
||
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) |
||
115 | { |
||
116 | return [ |
||
117 | 'id' => (int) $data['ResultID'], |
||
118 | 'started' => (int) $data['ResultStartTime'], |
||
119 | 'ended' => (int) $data['ResultEndTime'], |
||
120 | 'server' => (int) $data['ResultServer'], |
||
121 | 'zone' => (int) $data['ResultAlertCont'], |
||
122 | 'winner' => (string) $data['ResultWinner'], |
||
123 | 'timeBracket' => (string) $data['ResultTimeType'], |
||
124 | 'isDraw' => (boolean) $data['ResultDraw'], |
||
125 | 'isDomination' => (boolean) $data['ResultDomination'], |
||
126 | 'isValid' => (boolean) $data['Valid'], |
||
127 | 'inProgress' => (boolean) $data['InProgress'], |
||
128 | 'archived' => (boolean) $data['Archived'] |
||
129 | ]; |
||
130 | } |
||
131 | |||
132 | /** |
||
133 | * Gets the Class data and then adds it to the result |
||
134 | * |
||
135 | * @param array $data |
||
136 | * |
||
137 | * @return \League\Fractal\Resource\Collection |
||
138 | */ |
||
139 | public function includeClasses($data) |
||
144 | |||
145 | /** |
||
146 | * Gets the Combat History data and then adds it to the result |
||
147 | * |
||
148 | * @param array $data |
||
149 | * |
||
150 | * @return \League\Fractal\Resource\Collection |
||
151 | */ |
||
152 | public function includeCombatHistorys($data) |
||
157 | |||
158 | /** |
||
159 | * Gets the Combat data and then adds it to the result |
||
160 | * |
||
161 | * @param array $data |
||
162 | * |
||
163 | * @return \League\Fractal\Resource\Item |
||
164 | */ |
||
165 | public function includeCombats($data) |
||
170 | |||
171 | /** |
||
172 | * Gets the Class data and then adds it to the result |
||
173 | * |
||
174 | * @param array $data |
||
175 | * |
||
176 | * @return \League\Fractal\Resource\Collection |
||
177 | */ |
||
178 | public function includeMapInitials($data) |
||
183 | |||
184 | /** |
||
185 | * Gets the Map data and then adds it to the result |
||
186 | * |
||
187 | * @param array $data |
||
188 | * |
||
189 | * @return \League\Fractal\Resource\Collection |
||
190 | */ |
||
191 | public function includeMaps($data) |
||
196 | |||
197 | /** |
||
198 | * Gets the Outfit data and then adds it to the result |
||
199 | * |
||
200 | * @param array $data |
||
201 | * |
||
202 | * @return \League\Fractal\Resource\Collection |
||
203 | */ |
||
204 | public function includeOutfits($data) |
||
209 | |||
210 | /** |
||
211 | * Gets the Popualtion data and then adds it to the result |
||
212 | * |
||
213 | * @param array $data |
||
214 | * |
||
215 | * @return \League\Fractal\Resource\Collection |
||
216 | */ |
||
217 | public function includePopulations($data) |
||
222 | |||
223 | /** |
||
224 | * Gets the Player data and then adds it to the result |
||
225 | * |
||
226 | * @param array $data |
||
227 | * |
||
228 | * @return \League\Fractal\Resource\Collection |
||
229 | */ |
||
230 | public function includePlayers($data) |
||
235 | |||
236 | /** |
||
237 | * Gets the Vehicle data and then adds it to the result |
||
238 | * |
||
239 | * @param array $data |
||
240 | * |
||
241 | * @return \League\Fractal\Resource\Collection |
||
242 | */ |
||
243 | public function includeVehicles($data) |
||
248 | |||
249 | /** |
||
250 | * Gets the Weapon data and then adds it to the result |
||
251 | * |
||
252 | * @param array $data |
||
253 | * |
||
254 | * @return \League\Fractal\Resource\Collection |
||
255 | */ |
||
256 | public function includeWeapons($data) |
||
261 | |||
262 | /** |
||
263 | * Gets the XP data and then adds it to the result |
||
264 | * |
||
265 | * @param array $data |
||
266 | * |
||
267 | * @return \League\Fractal\Resource\Collection |
||
268 | */ |
||
269 | public function includeXps($data) |
||
275 | } |
||
276 |
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: