| Conditions | 2 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function transform(Tournament $tournament) |
||
| 19 | { |
||
| 20 | $teams = []; |
||
| 21 | |||
| 22 | foreach ($tournament->tournamentTeams as $tournamentTeam) { |
||
|
|
|||
| 23 | $teams[] = $tournamentTeam->id; |
||
| 24 | } |
||
| 25 | |||
| 26 | return [ |
||
| 27 | 'id' => $tournament->id, |
||
| 28 | 'name' => $tournament->name, |
||
| 29 | 'owner' => $tournament->owner, |
||
| 30 | 'status' => $tournament->status, |
||
| 31 | 'type' => $tournament->type, |
||
| 32 | 'membersType' => $tournament->membersType, |
||
| 33 | 'teams' => $teams, |
||
| 34 | 'description' => $tournament->description, |
||
| 35 | 'updated_at' => $tournament->updated_at->format('F d, Y') |
||
| 36 | ]; |
||
| 37 | } |
||
| 38 | } |
||
| 39 |
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.