Completed
Push — master ( 22bdaf...51334c )
by smiley
07:41
created
src/SettingsContainerAbstract.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -16,16 +16,16 @@  discard block
 block discarded – undo
16 16
 
17 17
 use function call_user_func, call_user_func_array, get_object_vars, json_decode, json_encode, method_exists, property_exists;
18 18
 
19
-abstract class SettingsContainerAbstract implements SettingsContainerInterface{
19
+abstract class SettingsContainerAbstract implements SettingsContainerInterface {
20 20
 
21 21
 	/**
22 22
 	 * SettingsContainerAbstract constructor.
23 23
 	 *
24 24
 	 * @param iterable|null $properties
25 25
 	 */
26
-	public function __construct(iterable $properties = null){
26
+	public function __construct(iterable $properties = null) {
27 27
 
28
-		if(!empty($properties)){
28
+		if (!empty($properties)) {
29 29
 			$this->fromIterable($properties);
30 30
 		}
31 31
 
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 	protected function construct():void{
42 42
 		$traits = (new ReflectionClass($this))->getTraits();
43 43
 
44
-		foreach($traits as $trait){
44
+		foreach ($traits as $trait) {
45 45
 			$method = $trait->getShortName();
46 46
 
47
-			if(method_exists($this, $method)){
47
+			if (method_exists($this, $method)) {
48 48
 				call_user_func([$this, $method]);
49 49
 			}
50 50
 		}
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 	/**
55 55
 	 * @inheritdoc
56 56
 	 */
57
-	public function __get(string $property){
57
+	public function __get(string $property) {
58 58
 
59
-		if(property_exists($this, $property) && !$this->isPrivate($property)){
59
+		if (property_exists($this, $property) && !$this->isPrivate($property)) {
60 60
 
61
-			if(method_exists($this, 'get_'.$property)){
61
+			if (method_exists($this, 'get_'.$property)) {
62 62
 				return call_user_func([$this, 'get_'.$property]);
63 63
 			}
64 64
 
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function __set(string $property, $value):void{
75 75
 
76
-		if(!property_exists($this, $property) || $this->isPrivate($property)){
76
+		if (!property_exists($this, $property) || $this->isPrivate($property)) {
77 77
 			return;
78 78
 		}
79 79
 
80
-		if(method_exists($this, 'set_'.$property)){
80
+		if (method_exists($this, 'set_'.$property)) {
81 81
 			call_user_func_array([$this, 'set_'.$property], [$value]);
82 82
 
83 83
 			return;
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function __unset(string $property):void{
111 111
 
112
-		if($this->__isset($property)){
112
+		if ($this->__isset($property)) {
113 113
 			unset($this->{$property});
114 114
 		}
115 115
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function fromIterable(iterable $properties):SettingsContainerInterface{
136 136
 
137
-		foreach($properties as $key => $value){
137
+		foreach ($properties as $key => $value) {
138 138
 			$this->__set($key, $value);
139 139
 		}
140 140
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	/**
161 161
 	 * @inheritdoc
162 162
 	 */
163
-	public function jsonSerialize(){
163
+	public function jsonSerialize() {
164 164
 		return $this->toArray();
165 165
 	}
166 166
 
Please login to merge, or discard this patch.