@@ -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; |
@@ -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){ |
@@ -180,15 +181,18 @@ discard block |
||
| 180 | 181 | $flag=false; |
| 181 | 182 | $index=0; |
| 182 | 183 | while ( !$flag && $index < sizeof($elements) ) { |
| 183 | - if ($elements[$index] instanceof BaseHtml) |
|
| 184 | - $flag=($elements[$index]->getIdentifier() === $identifier); |
|
| 184 | + if ($elements[$index] instanceof BaseHtml) { |
|
| 185 | + $flag=($elements[$index]->getIdentifier() === $identifier); |
|
| 186 | + } |
|
| 185 | 187 | $index++; |
| 186 | 188 | } |
| 187 | - if ($flag === true) |
|
| 188 | - return $elements[$index - 1]; |
|
| 189 | + if ($flag === true) { |
|
| 190 | + return $elements[$index - 1]; |
|
| 191 | + } |
|
| 189 | 192 | } elseif ($elements instanceof BaseHtml) { |
| 190 | - if ($elements->getIdentifier() === $identifier) |
|
| 191 | - return $elements; |
|
| 193 | + if ($elements->getIdentifier() === $identifier) { |
|
| 194 | + return $elements; |
|
| 195 | + } |
|
| 192 | 196 | } |
| 193 | 197 | return null; |
| 194 | 198 | } |
@@ -52,11 +52,17 @@ discard block |
||
| 52 | 52 | return $this; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | + /** |
|
| 56 | + * @param string $name |
|
| 57 | + */ |
|
| 55 | 58 | protected function removePropertyValue($name, $value) { |
| 56 | 59 | $this->properties[$name]=\str_replace($value, "", $this->properties[$name]); |
| 57 | 60 | return $this; |
| 58 | 61 | } |
| 59 | 62 | |
| 63 | + /** |
|
| 64 | + * @param string $name |
|
| 65 | + */ |
|
| 60 | 66 | protected function removePropertyValues($name, $values) { |
| 61 | 67 | $this->removeOldValues($this->properties[$name], $values); |
| 62 | 68 | return $this; |
@@ -71,6 +77,9 @@ discard block |
||
| 71 | 77 | return $this->addToProperty($name, $value); |
| 72 | 78 | } |
| 73 | 79 | |
| 80 | + /** |
|
| 81 | + * @param string $name |
|
| 82 | + */ |
|
| 74 | 83 | public function addToPropertyCtrl($name, $value, $typeCtrl) { |
| 75 | 84 | return $this->addToPropertyUnique($name, $value, $typeCtrl); |
| 76 | 85 | } |
@@ -82,6 +91,9 @@ discard block |
||
| 82 | 91 | return $this; |
| 83 | 92 | } |
| 84 | 93 | |
| 94 | + /** |
|
| 95 | + * @param string $name |
|
| 96 | + */ |
|
| 85 | 97 | public function removeProperty($name) { |
| 86 | 98 | if (\array_key_exists($name, $this->properties)) |
| 87 | 99 | unset($this->properties[$name]); |
@@ -102,6 +114,10 @@ discard block |
||
| 102 | 114 | return $this; |
| 103 | 115 | } |
| 104 | 116 | |
| 117 | + /** |
|
| 118 | + * @param string $propertyName |
|
| 119 | + * @param string $value |
|
| 120 | + */ |
|
| 105 | 121 | protected function getElementByPropertyValue($propertyName,$value, $elements) { |
| 106 | 122 | if (\is_array($elements)) { |
| 107 | 123 | $flag=false; |
@@ -26,8 +26,9 @@ discard block |
||
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | public function getProperty($name) { |
| 29 | - if (array_key_exists($name, $this->properties)) |
|
| 30 | - return $this->properties[$name]; |
|
| 29 | + if (array_key_exists($name, $this->properties)) { |
|
| 30 | + return $this->properties[$name]; |
|
| 31 | + } |
|
| 31 | 32 | } |
| 32 | 33 | |
| 33 | 34 | public function addToProperty($name, $value, $separator=" ") { |
@@ -37,10 +38,11 @@ discard block |
||
| 37 | 38 | } |
| 38 | 39 | } else if ($value !== "" && $this->propertyContains($name, $value) === false) { |
| 39 | 40 | $v=@$this->properties[$name]; |
| 40 | - if (isset($v) && $v !== "") |
|
| 41 | - $v=$v . $separator . $value; |
|
| 42 | - else |
|
| 43 | - $v=$value; |
|
| 41 | + if (isset($v) && $v !== "") { |
|
| 42 | + $v=$v . $separator . $value; |
|
| 43 | + } else { |
|
| 44 | + $v=$value; |
|
| 45 | + } |
|
| 44 | 46 | |
| 45 | 47 | return $this->setProperty($name, $v); |
| 46 | 48 | } |
@@ -63,8 +65,9 @@ discard block |
||
| 63 | 65 | } |
| 64 | 66 | |
| 65 | 67 | protected function addToPropertyUnique($name, $value, $typeCtrl) { |
| 66 | - if (@class_exists($typeCtrl, true)) |
|
| 67 | - $typeCtrl=$typeCtrl::getConstants(); |
|
| 68 | + if (@class_exists($typeCtrl, true)) { |
|
| 69 | + $typeCtrl=$typeCtrl::getConstants(); |
|
| 70 | + } |
|
| 68 | 71 | if (\is_array($typeCtrl)) { |
| 69 | 72 | $this->removeOldValues($this->properties[$name], $typeCtrl); |
| 70 | 73 | } |
@@ -83,8 +86,9 @@ discard block |
||
| 83 | 86 | } |
| 84 | 87 | |
| 85 | 88 | public function removeProperty($name) { |
| 86 | - if (\array_key_exists($name, $this->properties)) |
|
| 87 | - unset($this->properties[$name]); |
|
| 89 | + if (\array_key_exists($name, $this->properties)) { |
|
| 90 | + unset($this->properties[$name]); |
|
| 91 | + } |
|
| 88 | 92 | return $this; |
| 89 | 93 | } |
| 90 | 94 | |
@@ -97,8 +101,9 @@ discard block |
||
| 97 | 101 | } |
| 98 | 102 | |
| 99 | 103 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
| 100 | - if ($this->ctrl($name, $value, $typeCtrl) === true) |
|
| 101 | - return $this->setProperty($name, $value); |
|
| 104 | + if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 105 | + return $this->setProperty($name, $value); |
|
| 106 | + } |
|
| 102 | 107 | return $this; |
| 103 | 108 | } |
| 104 | 109 | |
@@ -107,15 +112,18 @@ discard block |
||
| 107 | 112 | $flag=false; |
| 108 | 113 | $index=0; |
| 109 | 114 | while ( !$flag && $index < sizeof($elements) ) { |
| 110 | - if ($elements[$index] instanceof BaseHtml) |
|
| 111 | - $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
| 115 | + if ($elements[$index] instanceof BaseHtml) { |
|
| 116 | + $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
| 117 | + } |
|
| 112 | 118 | $index++; |
| 113 | 119 | } |
| 114 | - if ($flag === true) |
|
| 115 | - return $elements[$index - 1]; |
|
| 120 | + if ($flag === true) { |
|
| 121 | + return $elements[$index - 1]; |
|
| 122 | + } |
|
| 116 | 123 | } elseif ($elements instanceof BaseHtml) { |
| 117 | - if ($elements->propertyContains($propertyName, $value) === true) |
|
| 118 | - return $elements; |
|
| 124 | + if ($elements->propertyContains($propertyName, $value) === true) { |
|
| 125 | + return $elements; |
|
| 126 | + } |
|
| 119 | 127 | } |
| 120 | 128 | return null; |
| 121 | 129 | } |