@@ -17,16 +17,16 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * a generic container with magic getter and setter |
19 | 19 | */ |
20 | -trait Container{ |
|
20 | +trait Container { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * @param array $properties |
24 | 24 | */ |
25 | - public function __construct(array $properties = null){ |
|
25 | + public function __construct(array $properties = null) { |
|
26 | 26 | |
27 | - if(!empty($properties)){ |
|
27 | + if (!empty($properties)) { |
|
28 | 28 | |
29 | - foreach($properties as $key => $value){ |
|
29 | + foreach ($properties as $key => $value) { |
|
30 | 30 | $this->__set($key, $value); |
31 | 31 | } |
32 | 32 | |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @return mixed |
41 | 41 | */ |
42 | - public function __get(string $property){ |
|
42 | + public function __get(string $property) { |
|
43 | 43 | |
44 | - if(property_exists($this, $property) && !(new ReflectionProperty($this, $property))->isPrivate()){ |
|
44 | + if (property_exists($this, $property) && !(new ReflectionProperty($this, $property))->isPrivate()) { |
|
45 | 45 | return $this->{$property}; |
46 | 46 | } |
47 | 47 | |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return void |
56 | 56 | */ |
57 | - public function __set(string $property, $value){ |
|
57 | + public function __set(string $property, $value) { |
|
58 | 58 | |
59 | - if(property_exists($this, $property) && !(new ReflectionProperty($this, $property))->isPrivate()){ |
|
59 | + if (property_exists($this, $property) && !(new ReflectionProperty($this, $property))->isPrivate()) { |
|
60 | 60 | $this->{$property} = $value; |
61 | 61 | } |
62 | 62 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | public function __toArray():array { |
69 | 69 | $data = []; |
70 | 70 | |
71 | - foreach($this as $key => $value){ |
|
71 | + foreach ($this as $key => $value) { |
|
72 | 72 | $data[$key] = $value; |
73 | 73 | } |
74 | 74 |