@@ -15,14 +15,14 @@ discard block |
||
| 15 | 15 | use function get_object_vars, json_decode, json_encode, method_exists, property_exists; |
| 16 | 16 | use const JSON_THROW_ON_ERROR; |
| 17 | 17 | |
| 18 | -abstract class SettingsContainerAbstract implements SettingsContainerInterface{ |
|
| 18 | +abstract class SettingsContainerAbstract implements SettingsContainerInterface { |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * SettingsContainerAbstract constructor. |
| 22 | 22 | */ |
| 23 | - public function __construct(iterable $properties = null){ |
|
| 23 | + public function __construct(iterable $properties = null) { |
|
| 24 | 24 | |
| 25 | - if(!empty($properties)){ |
|
| 25 | + if (!empty($properties)) { |
|
| 26 | 26 | $this->fromIterable($properties); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | protected function construct():void{ |
| 37 | 37 | $traits = (new ReflectionClass($this))->getTraits(); |
| 38 | 38 | |
| 39 | - foreach($traits as $trait){ |
|
| 39 | + foreach ($traits as $trait) { |
|
| 40 | 40 | $method = $trait->getShortName(); |
| 41 | 41 | |
| 42 | - if(method_exists($this, $method)){ |
|
| 42 | + if (method_exists($this, $method)) { |
|
| 43 | 43 | $this->{$method}(); |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -51,13 +51,13 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function __get(string $property):mixed{ |
| 53 | 53 | |
| 54 | - if(!property_exists($this, $property) || $this->isPrivate($property)){ |
|
| 54 | + if (!property_exists($this, $property) || $this->isPrivate($property)) { |
|
| 55 | 55 | return null; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | $method = 'get_'.$property; |
| 59 | 59 | |
| 60 | - if(method_exists($this, $method)){ |
|
| 60 | + if (method_exists($this, $method)) { |
|
| 61 | 61 | return $this->{$method}(); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -69,13 +69,13 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function __set(string $property, mixed $value):void{ |
| 71 | 71 | |
| 72 | - if(!property_exists($this, $property) || $this->isPrivate($property)){ |
|
| 72 | + if (!property_exists($this, $property) || $this->isPrivate($property)) { |
|
| 73 | 73 | return; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | $method = 'set_'.$property; |
| 77 | 77 | |
| 78 | - if(method_exists($this, $method)){ |
|
| 78 | + if (method_exists($this, $method)) { |
|
| 79 | 79 | $this->{$method}($value); |
| 80 | 80 | |
| 81 | 81 | return; |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function __unset(string $property):void{ |
| 105 | 105 | |
| 106 | - if($this->__isset($property)){ |
|
| 106 | + if ($this->__isset($property)) { |
|
| 107 | 107 | unset($this->{$property}); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | public function fromIterable(iterable $properties):SettingsContainerInterface{ |
| 130 | 130 | |
| 131 | - foreach($properties as $key => $value){ |
|
| 131 | + foreach ($properties as $key => $value) { |
|
| 132 | 132 | $this->__set($key, $value); |
| 133 | 133 | } |
| 134 | 134 | |