@@ -71,6 +71,10 @@ discard block |
||
71 | 71 | |
72 | 72 | |
73 | 73 | |
74 | + /** |
|
75 | + * @param string $name |
|
76 | + * @param string[] $typeCtrl |
|
77 | + */ |
|
74 | 78 | protected function setMemberCtrl(&$name, $value, $typeCtrl) { |
75 | 79 | if ($this->ctrl($name, $value, $typeCtrl) === true) { |
76 | 80 | return $name=$value; |
@@ -88,6 +92,10 @@ discard block |
||
88 | 92 | |
89 | 93 | |
90 | 94 | |
95 | + /** |
|
96 | + * @param string $name |
|
97 | + * @param string[] $typeCtrl |
|
98 | + */ |
|
91 | 99 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
92 | 100 | if ($this->ctrl($name, $value, $typeCtrl) === true) { |
93 | 101 | if (\is_array($typeCtrl)) { |
@@ -98,6 +106,9 @@ discard block |
||
98 | 106 | return $this; |
99 | 107 | } |
100 | 108 | |
109 | + /** |
|
110 | + * @param string $name |
|
111 | + */ |
|
101 | 112 | protected function addToMember(&$name, $value, $separator=" ") { |
102 | 113 | $name=str_ireplace($value, "", $name) . $separator . $value; |
103 | 114 | return $this; |
@@ -179,6 +190,9 @@ discard block |
||
179 | 190 | return $this->_getElementBy(function($element) use ($identifier){return $element->getIdentifier()===$identifier;}, $elements); |
180 | 191 | } |
181 | 192 | |
193 | + /** |
|
194 | + * @param \Closure $callback |
|
195 | + */ |
|
182 | 196 | protected function _getElementBy($callback,$elements){ |
183 | 197 | if (\is_array($elements)) { |
184 | 198 | $flag=false; |
@@ -128,8 +128,9 @@ discard block |
||
128 | 128 | |
129 | 129 | public function fromArray($array) { |
130 | 130 | foreach ( $this as $key => $value ) { |
131 | - if(array_key_exists($key, $array)===true) |
|
132 | - $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
131 | + if(array_key_exists($key, $array)===true) { |
|
132 | + $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
133 | + } |
|
133 | 134 | } |
134 | 135 | foreach ( $array as $key => $value ) { |
135 | 136 | if($this->_callSetter($key, $key, $value, $array)===false){ |
@@ -184,15 +185,18 @@ discard block |
||
184 | 185 | $flag=false; |
185 | 186 | $index=0; |
186 | 187 | while ( !$flag && $index < sizeof($elements) ) { |
187 | - if ($elements[$index] instanceof BaseHtml) |
|
188 | - $flag=($callback($elements[$index])); |
|
188 | + if ($elements[$index] instanceof BaseHtml) { |
|
189 | + $flag=($callback($elements[$index])); |
|
190 | + } |
|
189 | 191 | $index++; |
190 | 192 | } |
191 | - if ($flag === true) |
|
192 | - return $elements[$index - 1]; |
|
193 | + if ($flag === true) { |
|
194 | + return $elements[$index - 1]; |
|
195 | + } |
|
193 | 196 | } elseif ($elements instanceof BaseHtml) { |
194 | - if ($callback($elements)) |
|
195 | - return $elements; |
|
197 | + if ($callback($elements)) { |
|
198 | + return $elements; |
|
199 | + } |
|
196 | 200 | } |
197 | 201 | return null; |
198 | 202 | } |
@@ -33,8 +33,9 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | public function getProperty($name) { |
36 | - if (array_key_exists($name, $this->properties)) |
|
37 | - return $this->properties[$name]; |
|
36 | + if (array_key_exists($name, $this->properties)) { |
|
37 | + return $this->properties[$name]; |
|
38 | + } |
|
38 | 39 | } |
39 | 40 | |
40 | 41 | public function addToProperty($name, $value, $separator=" ") { |
@@ -44,10 +45,11 @@ discard block |
||
44 | 45 | } |
45 | 46 | } else if ($value !== "" && $this->propertyContains($name, $value) === false) { |
46 | 47 | $v=@$this->properties[$name]; |
47 | - if (isset($v) && $v !== "") |
|
48 | - $v=$v . $separator . $value; |
|
49 | - else |
|
50 | - $v=$value; |
|
48 | + if (isset($v) && $v !== "") { |
|
49 | + $v=$v . $separator . $value; |
|
50 | + } else { |
|
51 | + $v=$value; |
|
52 | + } |
|
51 | 53 | |
52 | 54 | return $this->setProperty($name, $v); |
53 | 55 | } |
@@ -70,8 +72,9 @@ discard block |
||
70 | 72 | } |
71 | 73 | |
72 | 74 | protected function addToPropertyUnique($name, $value, $typeCtrl) { |
73 | - if (@class_exists($typeCtrl, true)) |
|
74 | - $typeCtrl=$typeCtrl::getConstants(); |
|
75 | + if (@class_exists($typeCtrl, true)) { |
|
76 | + $typeCtrl=$typeCtrl::getConstants(); |
|
77 | + } |
|
75 | 78 | if (\is_array($typeCtrl)) { |
76 | 79 | $this->removeOldValues($this->properties[$name], $typeCtrl); |
77 | 80 | } |
@@ -90,8 +93,9 @@ discard block |
||
90 | 93 | } |
91 | 94 | |
92 | 95 | public function removeProperty($name) { |
93 | - if (\array_key_exists($name, $this->properties)) |
|
94 | - unset($this->properties[$name]); |
|
96 | + if (\array_key_exists($name, $this->properties)) { |
|
97 | + unset($this->properties[$name]); |
|
98 | + } |
|
95 | 99 | return $this; |
96 | 100 | } |
97 | 101 | |
@@ -104,8 +108,9 @@ discard block |
||
104 | 108 | } |
105 | 109 | |
106 | 110 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
107 | - if ($this->ctrl($name, $value, $typeCtrl) === true) |
|
108 | - return $this->setProperty($name, $value); |
|
111 | + if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
112 | + return $this->setProperty($name, $value); |
|
113 | + } |
|
109 | 114 | return $this; |
110 | 115 | } |
111 | 116 |