Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | 5 | public function transform($data): array |
|
19 | { |
||
20 | 5 | if (!($data instanceof Entity)) { |
|
21 | 1 | throw new TransformerException("Tried to transform not an Author"); |
|
22 | } |
||
23 | return [ |
||
24 | 4 | 'id' => $data->id ?? null, |
|
25 | 4 | 'name' => $data->name ?? null, |
|
26 | 4 | 'birthdate' => $data->birthdate ?? null, |
|
27 | 4 | 'deathdate' => $data->deathdate ?? null, |
|
28 | 4 | 'biography' => $data->biography ?? null, |
|
29 | 4 | 'summary' => $data->summary ?? null, |
|
30 | ]; |
||
33 |