| Total Complexity | 11 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class LayoutValue implements \Stringable |
||
| 8 | { |
||
| 9 | 5 | public function __construct( |
|
| 12 | 5 | } |
|
| 13 | |||
| 14 | 3 | public function __get(string $name) |
|
| 15 | { |
||
| 16 | 3 | return Arr::get($this->data, $name); |
|
| 17 | } |
||
| 18 | |||
| 19 | 2 | public function attribute(string $key): mixed |
|
| 20 | { |
||
| 21 | 2 | return Arr::get($this->data, "attributes.{$key}"); |
|
| 22 | } |
||
| 23 | |||
| 24 | 1 | public function layoutsAttribute(string $key): array |
|
| 25 | { |
||
| 26 | 1 | $value = $this->attribute($key); |
|
| 27 | 1 | if($value && is_array($value)) { |
|
| 28 | 1 | return array_values(array_filter(array_map(function ($item) { |
|
| 29 | 1 | $layoutValue = new LayoutValue(!is_array($item) ? (array)$item : $item); |
|
| 30 | 1 | if($layoutValue->layout && $layoutValue->key && is_array($layoutValue->attributes)) { |
|
| 31 | 1 | return $layoutValue; |
|
| 32 | } |
||
| 33 | |||
| 34 | 1 | return null; |
|
| 35 | 1 | }, $value))); |
|
| 36 | } |
||
| 37 | |||
| 38 | 1 | return []; |
|
| 39 | } |
||
| 40 | |||
| 41 | 1 | public function __toString(): string |
|
| 44 | } |
||
| 45 | } |
||
| 46 |