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