@@ -55,6 +55,10 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | |
| 58 | + /** |
|
| 59 | + * @param string $name |
|
| 60 | + * @param string[] $typeCtrl |
|
| 61 | + */ |
|
| 58 | 62 | protected function setMemberCtrl(&$name, $value, $typeCtrl) { |
| 59 | 63 | if ($this->ctrl($name, $value, $typeCtrl) === true) { |
| 60 | 64 | return $name=$value; |
@@ -72,6 +76,10 @@ discard block |
||
| 72 | 76 | |
| 73 | 77 | |
| 74 | 78 | |
| 79 | + /** |
|
| 80 | + * @param string $name |
|
| 81 | + * @param string[] $typeCtrl |
|
| 82 | + */ |
|
| 75 | 83 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
| 76 | 84 | if ($this->ctrl($name, $value, $typeCtrl) === true) { |
| 77 | 85 | if (\is_array($typeCtrl)) { |
@@ -82,6 +90,9 @@ discard block |
||
| 82 | 90 | return $this; |
| 83 | 91 | } |
| 84 | 92 | |
| 93 | + /** |
|
| 94 | + * @param string $name |
|
| 95 | + */ |
|
| 85 | 96 | protected function addToMember(&$name, $value, $separator=" ") { |
| 86 | 97 | $name=str_ireplace($value, "", $name) . $separator . $value; |
| 87 | 98 | return $this; |
@@ -94,6 +105,9 @@ discard block |
||
| 94 | 105 | $oldValue=trim($oldValue); |
| 95 | 106 | } |
| 96 | 107 | |
| 108 | + /** |
|
| 109 | + * @param \Closure $callback |
|
| 110 | + */ |
|
| 97 | 111 | protected function _getElementBy($callback,$elements){ |
| 98 | 112 | if (\is_array($elements)) { |
| 99 | 113 | $flag=false; |
@@ -99,15 +99,18 @@ discard block |
||
| 99 | 99 | $flag=false; |
| 100 | 100 | $index=0; |
| 101 | 101 | while ( !$flag && $index < sizeof($elements) ) { |
| 102 | - if ($elements[$index] instanceof BaseHtml) |
|
| 103 | - $flag=($callback($elements[$index])); |
|
| 102 | + if ($elements[$index] instanceof BaseHtml) { |
|
| 103 | + $flag=($callback($elements[$index])); |
|
| 104 | + } |
|
| 104 | 105 | $index++; |
| 105 | 106 | } |
| 106 | - if ($flag === true) |
|
| 107 | - return $elements[$index - 1]; |
|
| 107 | + if ($flag === true) { |
|
| 108 | + return $elements[$index - 1]; |
|
| 109 | + } |
|
| 108 | 110 | } elseif ($elements instanceof BaseHtml) { |
| 109 | - if ($callback($elements)) |
|
| 110 | - return $elements; |
|
| 111 | + if ($callback($elements)) { |
|
| 112 | + return $elements; |
|
| 113 | + } |
|
| 111 | 114 | } |
| 112 | 115 | return null; |
| 113 | 116 | } |
@@ -140,8 +143,9 @@ discard block |
||
| 140 | 143 | |
| 141 | 144 | public function fromArray($array) { |
| 142 | 145 | foreach ( $this as $key => $value ) { |
| 143 | - if(array_key_exists($key, $array)===true) |
|
| 144 | - $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
| 146 | + if(array_key_exists($key, $array)===true) { |
|
| 147 | + $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
| 148 | + } |
|
| 145 | 149 | } |
| 146 | 150 | foreach ( $array as $key => $value ) { |
| 147 | 151 | if($this->_callSetter($key, $key, $value, $array)===false){ |