Total Complexity | 7 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
12 | trait PropertyHandler |
||
13 | { |
||
14 | /** |
||
15 | * @param array $data |
||
16 | */ |
||
17 | 4 | public function fillProperties(array $data): void |
|
22 | } |
||
23 | 4 | } |
|
24 | |||
25 | /** |
||
26 | * @param string $property |
||
27 | * @param mixed $value |
||
28 | */ |
||
29 | 4 | public function fillProperty(string $property, $value): void |
|
30 | { |
||
31 | 4 | $property = lcfirst(str_replace('_', '', ucwords($property, '_'))); |
|
32 | 4 | if(property_exists(__CLASS__, $property)) |
|
33 | { |
||
34 | 4 | $method = sprintf('set%s', ucfirst($property)); |
|
35 | 4 | $this->{$method}($value); |
|
36 | } |
||
37 | 4 | } |
|
38 | |||
39 | /** |
||
40 | * @return array |
||
41 | */ |
||
42 | 1 | public function getPropertyArray(): array |
|
56 | } |
||
57 | |||
59 |