Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
28 | 9 | public function transform($searchable, array $array): array |
|
29 | { |
||
30 | 9 | foreach ($array as $key => $value) { |
|
31 | 9 | $attributeValue = $searchable->getModel()->getAttribute($key); |
|
32 | |||
33 | /* |
||
34 | * Casts carbon instances to timestamp. |
||
35 | */ |
||
36 | 9 | if ($attributeValue instanceof \Illuminate\Support\Carbon) { |
|
37 | 9 | $array[$key] = $attributeValue->getTimestamp(); |
|
38 | } |
||
39 | } |
||
40 | |||
41 | 9 | return $array; |
|
42 | } |
||
44 |