| Total Complexity | 8 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | trait Arrayable |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * Retrieves all not null attributes in an associative array. |
||
| 15 | * |
||
| 16 | * The keys in hash style: Ex: is-member |
||
| 17 | * The values as string |
||
| 18 | * |
||
| 19 | * @param bool $trimNull remove null values from array |
||
| 20 | * |
||
| 21 | * @return string[][] |
||
| 22 | */ |
||
| 23 | public function toArray($trimNull = true): array |
||
| 24 | { |
||
| 25 | if (isset($this->attributes) && is_array($this->attributes)) { |
||
| 26 | return $this->toArrayHyphen($this->attributes, $trimNull); |
||
| 27 | } |
||
| 28 | |||
| 29 | return $this->toArrayHyphen($this, $trimNull); |
||
| 30 | } |
||
| 31 | |||
| 32 | private function toArrayHyphen($array, $trimNull): array |
||
| 46 | } |
||
| 47 | } |
||
| 48 |