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