@@ -9,12 +9,12 @@ discard block |
||
9 | 9 | * @author jc |
10 | 10 | * @property BaseWidget $_self |
11 | 11 | */ |
12 | -trait BaseHtmlPropertiesTrait{ |
|
12 | +trait BaseHtmlPropertiesTrait { |
|
13 | 13 | |
14 | - protected $properties=array (); |
|
14 | + protected $properties=array(); |
|
15 | 15 | abstract protected function ctrl($name, $value, $typeCtrl); |
16 | 16 | abstract protected function removeOldValues(&$oldValue, $allValues); |
17 | - abstract protected function _getElementBy($callback,$elements); |
|
17 | + abstract protected function _getElementBy($callback, $elements); |
|
18 | 18 | public function getProperties() { |
19 | 19 | return $this->_self->properties; |
20 | 20 | } |
@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | |
41 | 41 | public function addToProperty($name, $value, $separator=" ") { |
42 | 42 | if (\is_array($value)) { |
43 | - foreach ( $value as $v ) { |
|
43 | + foreach ($value as $v) { |
|
44 | 44 | $this->_self->addToProperty($name, $v, $separator); |
45 | 45 | } |
46 | - } else if ($value !== "" && $this->_self->propertyContains($name, $value) === false) { |
|
46 | + } else if ($value!=="" && $this->_self->propertyContains($name, $value)===false) { |
|
47 | 47 | $v=@$this->_self->properties[$name]; |
48 | - if (isset($v) && $v !== "") |
|
49 | - $v=$v . $separator . $value; |
|
48 | + if (isset($v) && $v!=="") |
|
49 | + $v=$v.$separator.$value; |
|
50 | 50 | else |
51 | 51 | $v=$value; |
52 | 52 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | public function addToPropertyCtrlCheck($name, $value, $typeCtrl) { |
87 | - if ($this->_self->ctrl($name, $value, $typeCtrl) === true) { |
|
87 | + if ($this->_self->ctrl($name, $value, $typeCtrl)===true) { |
|
88 | 88 | return $this->_self->addToProperty($name, $value); |
89 | 89 | } |
90 | 90 | return $this; |
@@ -105,12 +105,12 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
108 | - if ($this->_self->ctrl($name, $value, $typeCtrl) === true) |
|
108 | + if ($this->_self->ctrl($name, $value, $typeCtrl)===true) |
|
109 | 109 | return $this->_self->setProperty($name, $value); |
110 | 110 | return $this; |
111 | 111 | } |
112 | 112 | |
113 | - protected function getElementByPropertyValue($propertyName,$value, $elements) { |
|
114 | - return $this->_self->_getElementBy(function($element) use ($propertyName,$value){return $element->propertyContains($propertyName, $value) === true;}, $elements); |
|
113 | + protected function getElementByPropertyValue($propertyName, $value, $elements) { |
|
114 | + return $this->_self->_getElementBy(function($element) use ($propertyName, $value){return $element->propertyContains($propertyName, $value)===true; }, $elements); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | \ No newline at end of file |
@@ -34,8 +34,9 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | public function getProperty($name) { |
37 | - if (array_key_exists($name, $this->_self->properties)) |
|
38 | - return $this->_self->properties[$name]; |
|
37 | + if (array_key_exists($name, $this->_self->properties)) { |
|
38 | + return $this->_self->properties[$name]; |
|
39 | + } |
|
39 | 40 | } |
40 | 41 | |
41 | 42 | public function addToProperty($name, $value, $separator=" ") { |
@@ -45,10 +46,11 @@ discard block |
||
45 | 46 | } |
46 | 47 | } else if ($value !== "" && $this->_self->propertyContains($name, $value) === false) { |
47 | 48 | $v=@$this->_self->properties[$name]; |
48 | - if (isset($v) && $v !== "") |
|
49 | - $v=$v . $separator . $value; |
|
50 | - else |
|
51 | - $v=$value; |
|
49 | + if (isset($v) && $v !== "") { |
|
50 | + $v=$v . $separator . $value; |
|
51 | + } else { |
|
52 | + $v=$value; |
|
53 | + } |
|
52 | 54 | |
53 | 55 | return $this->_self->setProperty($name, $v); |
54 | 56 | } |
@@ -71,8 +73,9 @@ discard block |
||
71 | 73 | } |
72 | 74 | |
73 | 75 | protected function addToPropertyUnique($name, $value, $typeCtrl) { |
74 | - if (@class_exists($typeCtrl, true)) |
|
75 | - $typeCtrl=$typeCtrl::getConstants(); |
|
76 | + if (@class_exists($typeCtrl, true)) { |
|
77 | + $typeCtrl=$typeCtrl::getConstants(); |
|
78 | + } |
|
76 | 79 | if (\is_array($typeCtrl)) { |
77 | 80 | $this->_self->removeOldValues($this->_self->properties[$name], $typeCtrl); |
78 | 81 | } |
@@ -91,8 +94,9 @@ discard block |
||
91 | 94 | } |
92 | 95 | |
93 | 96 | public function removeProperty($name) { |
94 | - if (\array_key_exists($name, $this->_self->properties)) |
|
95 | - unset($this->_self->properties[$name]); |
|
97 | + if (\array_key_exists($name, $this->_self->properties)) { |
|
98 | + unset($this->_self->properties[$name]); |
|
99 | + } |
|
96 | 100 | return $this; |
97 | 101 | } |
98 | 102 | |
@@ -105,8 +109,9 @@ discard block |
||
105 | 109 | } |
106 | 110 | |
107 | 111 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
108 | - if ($this->_self->ctrl($name, $value, $typeCtrl) === true) |
|
109 | - return $this->_self->setProperty($name, $value); |
|
112 | + if ($this->_self->ctrl($name, $value, $typeCtrl) === true) { |
|
113 | + return $this->_self->setProperty($name, $value); |
|
114 | + } |
|
110 | 115 | return $this; |
111 | 116 | } |
112 | 117 |