@@ -14,16 +14,16 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | use ReflectionClass, ReflectionProperty; |
| 16 | 16 | |
| 17 | -abstract class SettingsContainerAbstract implements SettingsContainerInterface{ |
|
| 17 | +abstract class SettingsContainerAbstract implements SettingsContainerInterface { |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * SettingsContainerAbstract constructor. |
| 21 | 21 | * |
| 22 | 22 | * @param iterable|null $properties |
| 23 | 23 | */ |
| 24 | - public function __construct(iterable $properties = null){ |
|
| 24 | + public function __construct(iterable $properties = null) { |
|
| 25 | 25 | |
| 26 | - if(!empty($properties)){ |
|
| 26 | + if (!empty($properties)) { |
|
| 27 | 27 | $this->fromIterable($properties); |
| 28 | 28 | } |
| 29 | 29 | |
@@ -39,10 +39,10 @@ discard block |
||
| 39 | 39 | protected function construct():void{ |
| 40 | 40 | $traits = (new ReflectionClass($this))->getTraits(); |
| 41 | 41 | |
| 42 | - foreach($traits as $trait){ |
|
| 42 | + foreach ($traits as $trait) { |
|
| 43 | 43 | $method = $trait->getShortName(); |
| 44 | 44 | |
| 45 | - if(method_exists($this, $method)){ |
|
| 45 | + if (method_exists($this, $method)) { |
|
| 46 | 46 | call_user_func([$this, $method]); |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * @inheritdoc |
| 54 | 54 | */ |
| 55 | - public function __get(string $property){ |
|
| 55 | + public function __get(string $property) { |
|
| 56 | 56 | |
| 57 | - if($this->__isset($property)){ |
|
| 57 | + if ($this->__isset($property)) { |
|
| 58 | 58 | return $this->{$property}; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function __set(string $property, $value):void{ |
| 68 | 68 | |
| 69 | - if(!property_exists($this, $property) || $this->isPrivate($property)){ |
|
| 69 | + if (!property_exists($this, $property) || $this->isPrivate($property)) { |
|
| 70 | 70 | return; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if(method_exists($this, 'set_'.$property)){ |
|
| 73 | + if (method_exists($this, 'set_'.$property)) { |
|
| 74 | 74 | $this->{'set_'.$property}($value); |
| 75 | 75 | |
| 76 | 76 | return; |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function __unset(string $property):void{ |
| 104 | 104 | |
| 105 | - if($this->__isset($property)){ |
|
| 105 | + if ($this->__isset($property)) { |
|
| 106 | 106 | unset($this->{$property}); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function fromIterable(iterable $properties):SettingsContainerInterface{ |
| 129 | 129 | |
| 130 | - foreach($properties as $key => $value){ |
|
| 130 | + foreach ($properties as $key => $value) { |
|
| 131 | 131 | $this->__set($key, $value); |
| 132 | 132 | } |
| 133 | 133 | |