@@ -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 | |