@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | return $this->content; |
28 | 28 | } |
29 | 29 | |
30 | - public function addContent($content,$before=false) { |
|
30 | + public function addContent($content, $before=false) { |
|
31 | 31 | if (!\is_array($this->content)) { |
32 | - if(isset($this->content)) |
|
33 | - $this->content=array ($this->content); |
|
32 | + if (isset($this->content)) |
|
33 | + $this->content=array($this->content); |
|
34 | 34 | else |
35 | 35 | $this->content=array(); |
36 | 36 | } |
37 | - if($before) |
|
38 | - array_unshift($this->content,$content); |
|
37 | + if ($before) |
|
38 | + array_unshift($this->content, $content); |
|
39 | 39 | else |
40 | 40 | $this->content []=$content; |
41 | 41 | return $this; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | if ($this->content instanceof HtmlDoubleElement) { |
51 | 51 | $this->content->run($js); |
52 | 52 | } else if (\is_array($this->content)) { |
53 | - foreach ( $this->content as $itemContent ) { |
|
53 | + foreach ($this->content as $itemContent) { |
|
54 | 54 | if ($itemContent instanceof HtmlDoubleElement) { |
55 | 55 | $itemContent->run($js); |
56 | 56 | } |
@@ -67,19 +67,19 @@ discard block |
||
67 | 67 | return $this; |
68 | 68 | } |
69 | 69 | |
70 | - public function getContentInstances($class){ |
|
71 | - return $this->_getContentInstances($class,$this->content); |
|
70 | + public function getContentInstances($class) { |
|
71 | + return $this->_getContentInstances($class, $this->content); |
|
72 | 72 | } |
73 | 73 | |
74 | - protected function _getContentInstances($class,$content){ |
|
74 | + protected function _getContentInstances($class, $content) { |
|
75 | 75 | $instances=[]; |
76 | - if($content instanceof $class){ |
|
76 | + if ($content instanceof $class) { |
|
77 | 77 | $instances[]=$content; |
78 | - }elseif($content instanceof HtmlDoubleElement){ |
|
79 | - $instances=\array_merge($instances,$content->getContentInstances($class)); |
|
80 | - }elseif (\is_array($content)){ |
|
81 | - foreach ($content as $element){ |
|
82 | - $instances=\array_merge($instances,$this->_getContentInstances($class, $element)); |
|
78 | + }elseif ($content instanceof HtmlDoubleElement) { |
|
79 | + $instances=\array_merge($instances, $content->getContentInstances($class)); |
|
80 | + }elseif (\is_array($content)) { |
|
81 | + foreach ($content as $element) { |
|
82 | + $instances=\array_merge($instances, $this->_getContentInstances($class, $element)); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | return $instances; |
@@ -29,15 +29,17 @@ discard block |
||
29 | 29 | |
30 | 30 | public function addContent($content,$before=false) { |
31 | 31 | if (!\is_array($this->content)) { |
32 | - if(isset($this->content)) |
|
33 | - $this->content=array ($this->content); |
|
34 | - else |
|
35 | - $this->content=array(); |
|
32 | + if(isset($this->content)) { |
|
33 | + $this->content=array ($this->content); |
|
34 | + } else { |
|
35 | + $this->content=array(); |
|
36 | + } |
|
37 | + } |
|
38 | + if($before) { |
|
39 | + array_unshift($this->content,$content); |
|
40 | + } else { |
|
41 | + $this->content []=$content; |
|
36 | 42 | } |
37 | - if($before) |
|
38 | - array_unshift($this->content,$content); |
|
39 | - else |
|
40 | - $this->content []=$content; |
|
41 | 43 | return $this; |
42 | 44 | } |
43 | 45 | |
@@ -75,9 +77,9 @@ discard block |
||
75 | 77 | $instances=[]; |
76 | 78 | if($content instanceof $class){ |
77 | 79 | $instances[]=$content; |
78 | - }elseif($content instanceof HtmlDoubleElement){ |
|
80 | + } elseif($content instanceof HtmlDoubleElement){ |
|
79 | 81 | $instances=\array_merge($instances,$content->getContentInstances($class)); |
80 | - }elseif (\is_array($content)){ |
|
82 | + } elseif (\is_array($content)){ |
|
81 | 83 | foreach ($content as $element){ |
82 | 84 | $instances=\array_merge($instances,$this->_getContentInstances($class, $element)); |
83 | 85 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | class HtmlInput extends HtmlSingleElement { |
10 | 10 | protected $_placeholder; |
11 | - public function __construct($identifier,$type="text",$value=NULL,$placeholder=NULL) { |
|
11 | + public function __construct($identifier, $type="text", $value=NULL, $placeholder=NULL) { |
|
12 | 12 | parent::__construct($identifier, "input"); |
13 | 13 | $this->setProperty("name", $identifier); |
14 | 14 | $this->setValue($value); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | } |
18 | 18 | |
19 | 19 | public function setValue($value) { |
20 | - if(isset($value)) |
|
20 | + if (isset($value)) |
|
21 | 21 | $this->setProperty("value", $value); |
22 | 22 | return $this; |
23 | 23 | } |
@@ -26,19 +26,19 @@ discard block |
||
26 | 26 | return $this->setProperty("type", $value); |
27 | 27 | } |
28 | 28 | |
29 | - public function setPlaceholder($value){ |
|
30 | - if(JString::isNotNull($value)) |
|
29 | + public function setPlaceholder($value) { |
|
30 | + if (JString::isNotNull($value)) |
|
31 | 31 | $this->_placeholder=$value; |
32 | 32 | return $this; |
33 | 33 | } |
34 | 34 | |
35 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
35 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
36 | 36 | $value=$this->_placeholder; |
37 | - if(JString::isNull($value)){ |
|
38 | - if(JString::isNotNull($this->getProperty("name"))) |
|
37 | + if (JString::isNull($value)) { |
|
38 | + if (JString::isNotNull($this->getProperty("name"))) |
|
39 | 39 | $value=\ucfirst($this->getProperty("name")); |
40 | 40 | } |
41 | 41 | $this->setProperty("placeholder", $value); |
42 | - return parent::compile($js,$view); |
|
42 | + return parent::compile($js, $view); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | \ No newline at end of file |
@@ -17,8 +17,9 @@ discard block |
||
17 | 17 | } |
18 | 18 | |
19 | 19 | public function setValue($value) { |
20 | - if(isset($value)) |
|
21 | - $this->setProperty("value", $value); |
|
20 | + if(isset($value)) { |
|
21 | + $this->setProperty("value", $value); |
|
22 | + } |
|
22 | 23 | return $this; |
23 | 24 | } |
24 | 25 | |
@@ -27,16 +28,18 @@ discard block |
||
27 | 28 | } |
28 | 29 | |
29 | 30 | public function setPlaceholder($value){ |
30 | - if(JString::isNotNull($value)) |
|
31 | - $this->_placeholder=$value; |
|
31 | + if(JString::isNotNull($value)) { |
|
32 | + $this->_placeholder=$value; |
|
33 | + } |
|
32 | 34 | return $this; |
33 | 35 | } |
34 | 36 | |
35 | 37 | public function compile(JsUtils $js=NULL,&$view=NULL){ |
36 | 38 | $value=$this->_placeholder; |
37 | 39 | if(JString::isNull($value)){ |
38 | - if(JString::isNotNull($this->getProperty("name"))) |
|
39 | - $value=\ucfirst($this->getProperty("name")); |
|
40 | + if(JString::isNotNull($this->getProperty("name"))) { |
|
41 | + $value=\ucfirst($this->getProperty("name")); |
|
42 | + } |
|
40 | 43 | } |
41 | 44 | $this->setProperty("placeholder", $value); |
42 | 45 | return parent::compile($js,$view); |
@@ -186,8 +186,9 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function addItemInToolbar($caption,$icon=NULL,$callback=NULL){ |
188 | 188 | $result=$this->addInToolbar($caption,$callback); |
189 | - if(isset($icon)) |
|
190 | - $result->addIcon($icon); |
|
189 | + if(isset($icon)) { |
|
190 | + $result->addIcon($icon); |
|
191 | + } |
|
191 | 192 | return $result; |
192 | 193 | } |
193 | 194 | |
@@ -201,7 +202,7 @@ discard block |
||
201 | 202 | foreach ($items as $icon=>$item){ |
202 | 203 | $this->addItemInToolbar($item,$icon,$callback); |
203 | 204 | } |
204 | - }else{ |
|
205 | + } else{ |
|
205 | 206 | foreach ($items as $item){ |
206 | 207 | $this->addItemInToolbar($item,null,$callback); |
207 | 208 | } |
@@ -352,8 +353,9 @@ discard block |
||
352 | 353 | protected function _compileForm(){ |
353 | 354 | if(isset($this->_form)){ |
354 | 355 | $noValidate=""; |
355 | - if(\sizeof($this->_form->getValidationParams())>0) |
|
356 | - $noValidate="novalidate"; |
|
356 | + if(\sizeof($this->_form->getValidationParams())>0) { |
|
357 | + $noValidate="novalidate"; |
|
358 | + } |
|
357 | 359 | $this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">","</form>"); |
358 | 360 | } |
359 | 361 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | use Ajax\semantic\html\modules\HtmlModal; |
21 | 21 | |
22 | 22 | abstract class Widget extends HtmlDoubleElement { |
23 | - use FieldAsTrait,FormTrait; |
|
23 | + use FieldAsTrait, FormTrait; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @var string classname |
@@ -53,17 +53,17 @@ discard block |
||
53 | 53 | protected $_generated; |
54 | 54 | |
55 | 55 | |
56 | - public function __construct($identifier,$model,$modelInstance=NULL) { |
|
56 | + public function __construct($identifier, $model, $modelInstance=NULL) { |
|
57 | 57 | parent::__construct($identifier); |
58 | 58 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
59 | 59 | $this->setModel($model); |
60 | - if(isset($modelInstance)){ |
|
60 | + if (isset($modelInstance)) { |
|
61 | 61 | $this->show($modelInstance); |
62 | 62 | } |
63 | 63 | $this->_generated=false; |
64 | 64 | } |
65 | 65 | |
66 | - protected function _init($instanceViewer,$contentKey,$content,$edition){ |
|
66 | + protected function _init($instanceViewer, $contentKey, $content, $edition) { |
|
67 | 67 | $this->_instanceViewer=$instanceViewer; |
68 | 68 | $this->content=[$contentKey=>$content]; |
69 | 69 | $this->_toolbarPosition=PositionInTable::BEFORETABLE; |
@@ -74,26 +74,26 @@ discard block |
||
74 | 74 | * @param int|string $fieldName |
75 | 75 | * @return int|string |
76 | 76 | */ |
77 | - protected function _getIndex($fieldName){ |
|
77 | + protected function _getIndex($fieldName) { |
|
78 | 78 | return $fieldName; |
79 | 79 | } |
80 | 80 | |
81 | - protected function _getFieldIdentifier($prefix,$name=""){ |
|
81 | + protected function _getFieldIdentifier($prefix, $name="") { |
|
82 | 82 | return $this->identifier."-{$prefix}-".$this->_instanceViewer->getIdentifier(); |
83 | 83 | } |
84 | 84 | |
85 | - protected function _getFieldName($index){ |
|
85 | + protected function _getFieldName($index) { |
|
86 | 86 | return $this->_instanceViewer->getFieldName($index); |
87 | 87 | } |
88 | 88 | |
89 | - protected function _getFieldCaption($index){ |
|
89 | + protected function _getFieldCaption($index) { |
|
90 | 90 | return $this->_instanceViewer->getCaption($index); |
91 | 91 | } |
92 | 92 | |
93 | - abstract protected function _setToolbarPosition($table,$captions=NULL); |
|
93 | + abstract protected function _setToolbarPosition($table, $captions=NULL); |
|
94 | 94 | |
95 | - public function show($modelInstance){ |
|
96 | - if(\is_array($modelInstance)){ |
|
95 | + public function show($modelInstance) { |
|
96 | + if (\is_array($modelInstance)) { |
|
97 | 97 | $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
98 | 98 | } |
99 | 99 | $this->_modelInstance=$modelInstance; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | abstract public function getHtmlComponent(); |
121 | 121 | |
122 | - public function setAttached($value=true){ |
|
122 | + public function setAttached($value=true) { |
|
123 | 123 | return $this->getHtmlComponent()->setAttached($value); |
124 | 124 | } |
125 | 125 | |
@@ -130,66 +130,66 @@ discard block |
||
130 | 130 | * @param callable $callback function called after the field compilation |
131 | 131 | * @return Widget |
132 | 132 | */ |
133 | - public function afterCompile($index,$callback){ |
|
133 | + public function afterCompile($index, $callback) { |
|
134 | 134 | $index=$this->_getIndex($index); |
135 | 135 | $this->_instanceViewer->afterCompile($index, $callback); |
136 | 136 | return $this; |
137 | 137 | } |
138 | 138 | |
139 | - public function setColor($color){ |
|
139 | + public function setColor($color) { |
|
140 | 140 | return $this->getHtmlComponent()->setColor($color); |
141 | 141 | } |
142 | 142 | |
143 | 143 | |
144 | - public function setCaptions($captions){ |
|
144 | + public function setCaptions($captions) { |
|
145 | 145 | $this->_instanceViewer->setCaptions($captions); |
146 | 146 | return $this; |
147 | 147 | } |
148 | 148 | |
149 | - public function setCaption($index,$caption){ |
|
149 | + public function setCaption($index, $caption) { |
|
150 | 150 | $this->_instanceViewer->setCaption($this->_getIndex($index), $caption); |
151 | 151 | return $this; |
152 | 152 | } |
153 | 153 | |
154 | - public function setFields($fields){ |
|
154 | + public function setFields($fields) { |
|
155 | 155 | $this->_instanceViewer->setVisibleProperties($fields); |
156 | 156 | return $this; |
157 | 157 | } |
158 | 158 | |
159 | - public function addField($field){ |
|
159 | + public function addField($field) { |
|
160 | 160 | $this->_instanceViewer->addField($field); |
161 | 161 | return $this; |
162 | 162 | } |
163 | 163 | |
164 | - public function addMessage($attributes=NULL,$fieldName="message"){ |
|
164 | + public function addMessage($attributes=NULL, $fieldName="message") { |
|
165 | 165 | $this->_instanceViewer->addField($fieldName); |
166 | 166 | $count=$this->_instanceViewer->visiblePropertiesCount(); |
167 | - return $this->fieldAsMessage($count-1,$attributes); |
|
167 | + return $this->fieldAsMessage($count-1, $attributes); |
|
168 | 168 | } |
169 | 169 | |
170 | - public function addErrorMessage(){ |
|
171 | - return $this->addMessage(["error"=>true],"message"); |
|
170 | + public function addErrorMessage() { |
|
171 | + return $this->addMessage(["error"=>true], "message"); |
|
172 | 172 | } |
173 | 173 | |
174 | - public function insertField($index,$field){ |
|
174 | + public function insertField($index, $field) { |
|
175 | 175 | $index=$this->_getIndex($index); |
176 | 176 | $this->_instanceViewer->insertField($index, $field); |
177 | 177 | return $this; |
178 | 178 | } |
179 | 179 | |
180 | - public function insertInField($index,$field){ |
|
180 | + public function insertInField($index, $field) { |
|
181 | 181 | $index=$this->_getIndex($index); |
182 | 182 | $this->_instanceViewer->insertInField($index, $field); |
183 | 183 | return $this; |
184 | 184 | } |
185 | 185 | |
186 | - public function setValueFunction($index,$callback){ |
|
186 | + public function setValueFunction($index, $callback) { |
|
187 | 187 | $index=$this->_getIndex($index); |
188 | 188 | $this->_instanceViewer->setValueFunction($index, $callback); |
189 | 189 | return $this; |
190 | 190 | } |
191 | 191 | |
192 | - public function setIdentifierFunction($callback){ |
|
192 | + public function setIdentifierFunction($callback) { |
|
193 | 193 | $this->_instanceViewer->setIdentifierFunction($callback); |
194 | 194 | return $this; |
195 | 195 | } |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | /** |
198 | 198 | * @return \Ajax\semantic\html\collections\menus\HtmlMenu |
199 | 199 | */ |
200 | - public function getToolbar(){ |
|
201 | - if(isset($this->_toolbar)===false){ |
|
200 | + public function getToolbar() { |
|
201 | + if (isset($this->_toolbar)===false) { |
|
202 | 202 | $this->_toolbar=new HtmlMenu("toolbar-".$this->identifier); |
203 | 203 | } |
204 | 204 | return $this->_toolbar; |
@@ -210,15 +210,15 @@ discard block |
||
210 | 210 | * @param callable $callback function to call on $element |
211 | 211 | * @return \Ajax\common\html\HtmlDoubleElement |
212 | 212 | */ |
213 | - public function addInToolbar($element,$callback=NULL){ |
|
213 | + public function addInToolbar($element, $callback=NULL) { |
|
214 | 214 | $tb=$this->getToolbar(); |
215 | - if($element instanceof BaseWidget){ |
|
216 | - if($element->getIdentifier()===""){ |
|
215 | + if ($element instanceof BaseWidget) { |
|
216 | + if ($element->getIdentifier()==="") { |
|
217 | 217 | $element->setIdentifier("tb-item-".$this->identifier."-".$tb->count()); |
218 | 218 | } |
219 | 219 | } |
220 | - if(isset($callback)){ |
|
221 | - if(\is_callable($callback)){ |
|
220 | + if (isset($callback)) { |
|
221 | + if (\is_callable($callback)) { |
|
222 | 222 | $callback($element); |
223 | 223 | } |
224 | 224 | } |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | * @param callable $callback function($element) |
232 | 232 | * @return \Ajax\common\html\HtmlDoubleElement |
233 | 233 | */ |
234 | - public function addItemInToolbar($caption,$icon=NULL,$callback=NULL){ |
|
235 | - $result=$this->addInToolbar($caption,$callback); |
|
236 | - if(isset($icon)) |
|
234 | + public function addItemInToolbar($caption, $icon=NULL, $callback=NULL) { |
|
235 | + $result=$this->addInToolbar($caption, $callback); |
|
236 | + if (isset($icon)) |
|
237 | 237 | $result->addIcon($icon); |
238 | 238 | return $result; |
239 | 239 | } |
@@ -243,14 +243,14 @@ discard block |
||
243 | 243 | * @param callable $callback function($element) |
244 | 244 | * @return \Ajax\common\Widget |
245 | 245 | */ |
246 | - public function addItemsInToolbar(array $items,$callback=NULL){ |
|
247 | - if(JArray::isAssociative($items)){ |
|
248 | - foreach ($items as $icon=>$item){ |
|
249 | - $this->addItemInToolbar($item,$icon,$callback); |
|
246 | + public function addItemsInToolbar(array $items, $callback=NULL) { |
|
247 | + if (JArray::isAssociative($items)) { |
|
248 | + foreach ($items as $icon=>$item) { |
|
249 | + $this->addItemInToolbar($item, $icon, $callback); |
|
250 | 250 | } |
251 | - }else{ |
|
252 | - foreach ($items as $item){ |
|
253 | - $this->addItemInToolbar($item,null,$callback); |
|
251 | + } else { |
|
252 | + foreach ($items as $item) { |
|
253 | + $this->addItemInToolbar($item, null, $callback); |
|
254 | 254 | } |
255 | 255 | } |
256 | 256 | return $this; |
@@ -262,12 +262,12 @@ discard block |
||
262 | 262 | * @param callable $callback function($element) |
263 | 263 | * @return \Ajax\common\html\HtmlDoubleElement |
264 | 264 | */ |
265 | - public function addDropdownInToolbar($value,$items,$callback=NULL){ |
|
265 | + public function addDropdownInToolbar($value, $items, $callback=NULL) { |
|
266 | 266 | $dd=$value; |
267 | 267 | if (\is_string($value)) { |
268 | - $dd=new HtmlDropdown("dropdown-". $this->identifier."-".$value, $value, $items); |
|
268 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$value, $value, $items); |
|
269 | 269 | } |
270 | - return $this->addInToolbar($dd,$callback); |
|
270 | + return $this->addInToolbar($dd, $callback); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | /** |
@@ -276,9 +276,9 @@ discard block |
||
276 | 276 | * @param callable $callback function($element) |
277 | 277 | * @return \Ajax\common\html\HtmlDoubleElement |
278 | 278 | */ |
279 | - public function addButtonInToolbar($caption,$cssStyle=null,$callback=NULL){ |
|
280 | - $bt=new HtmlButton("bt-".$caption,$caption,$cssStyle); |
|
281 | - return $this->addInToolbar($bt,$callback); |
|
279 | + public function addButtonInToolbar($caption, $cssStyle=null, $callback=NULL) { |
|
280 | + $bt=new HtmlButton("bt-".$caption, $caption, $cssStyle); |
|
281 | + return $this->addInToolbar($bt, $callback); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -287,9 +287,9 @@ discard block |
||
287 | 287 | * @param callable $callback function($element) |
288 | 288 | * @return \Ajax\common\html\HtmlDoubleElement |
289 | 289 | */ |
290 | - public function addButtonsInToolbar(array $captions,$asIcon=false,$callback=NULL){ |
|
291 | - $bts=new HtmlButtonGroups("",$captions,$asIcon); |
|
292 | - return $this->addInToolbar($bts,$callback); |
|
290 | + public function addButtonsInToolbar(array $captions, $asIcon=false, $callback=NULL) { |
|
291 | + $bts=new HtmlButtonGroups("", $captions, $asIcon); |
|
292 | + return $this->addInToolbar($bts, $callback); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
@@ -299,15 +299,15 @@ discard block |
||
299 | 299 | * @param boolean $labeled |
300 | 300 | * @return \Ajax\common\html\HtmlDoubleElement |
301 | 301 | */ |
302 | - public function addLabelledIconButtonInToolbar($caption,$icon,$before=true,$labeled=false){ |
|
303 | - $bt=new HtmlButton("",$caption); |
|
304 | - $bt->addIcon($icon,$before,$labeled); |
|
302 | + public function addLabelledIconButtonInToolbar($caption, $icon, $before=true, $labeled=false) { |
|
303 | + $bt=new HtmlButton("", $caption); |
|
304 | + $bt->addIcon($icon, $before, $labeled); |
|
305 | 305 | return $this->addInToolbar($bt); |
306 | 306 | } |
307 | 307 | |
308 | - public function addSubmitInToolbar($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){ |
|
309 | - $button=new HtmlButton($identifier,$value,$cssStyle); |
|
310 | - $this->_buttonAsSubmit($button,"click",$url,$responseElement,$parameters); |
|
308 | + public function addSubmitInToolbar($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) { |
|
309 | + $button=new HtmlButton($identifier, $value, $cssStyle); |
|
310 | + $this->_buttonAsSubmit($button, "click", $url, $responseElement, $parameters); |
|
311 | 311 | return $this->addInToolbar($button); |
312 | 312 | } |
313 | 313 | |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | * @param callable $defaultValueFunction function parameters are : $name : the field name, $value : the field value ,$index : the field index, $instance : the active instance of model |
338 | 338 | * @return \Ajax\common\Widget |
339 | 339 | */ |
340 | - public function setDefaultValueFunction($defaultValueFunction){ |
|
340 | + public function setDefaultValueFunction($defaultValueFunction) { |
|
341 | 341 | $this->_instanceViewer->setDefaultValueFunction($defaultValueFunction); |
342 | 342 | return $this; |
343 | 343 | } |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | * @param string|boolean $disable |
347 | 347 | * @return string |
348 | 348 | */ |
349 | - public function jsDisabled($disable=true){ |
|
349 | + public function jsDisabled($disable=true) { |
|
350 | 350 | return "$('#".$this->identifier." .ui.input,#".$this->identifier." .ui.dropdown,#".$this->identifier." .ui.checkbox').toggleClass('disabled',".$disable.");"; |
351 | 351 | } |
352 | 352 | |
@@ -355,12 +355,12 @@ discard block |
||
355 | 355 | * @param callable $callback function($element) |
356 | 356 | * @return \Ajax\common\html\HtmlDoubleElement |
357 | 357 | */ |
358 | - public function addEditButtonInToolbar($caption,$callback=NULL){ |
|
359 | - $bt=new HtmlButton($this->identifier."-editBtn",$caption); |
|
358 | + public function addEditButtonInToolbar($caption, $callback=NULL) { |
|
359 | + $bt=new HtmlButton($this->identifier."-editBtn", $caption); |
|
360 | 360 | $bt->setToggle(); |
361 | 361 | $bt->setActive($this->_edition); |
362 | 362 | $bt->onClick($this->jsDisabled(Javascript::prep_value("!$(event.target).hasClass('active')"))); |
363 | - return $this->addInToolbar($bt,$callback); |
|
363 | + return $this->addInToolbar($bt, $callback); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | public function setToolbar(HtmlMenu $_toolbar) { |
@@ -374,35 +374,35 @@ discard block |
||
374 | 374 | } |
375 | 375 | |
376 | 376 | public function getForm() { |
377 | - if(!isset($this->_form)){ |
|
377 | + if (!isset($this->_form)) { |
|
378 | 378 | $this->_form=new HtmlForm("frm-".$this->identifier); |
379 | 379 | $this->setEdition(true); |
380 | 380 | } |
381 | 381 | return $this->_form; |
382 | 382 | } |
383 | 383 | |
384 | - public function run(JsUtils $js){ |
|
384 | + public function run(JsUtils $js) { |
|
385 | 385 | $result=parent::run($js); |
386 | - if(isset($this->_form)){ |
|
386 | + if (isset($this->_form)) { |
|
387 | 387 | $result=$this->runForm($js); |
388 | 388 | } |
389 | 389 | return $result; |
390 | 390 | } |
391 | 391 | |
392 | - protected function runForm(JsUtils $js){ |
|
392 | + protected function runForm(JsUtils $js) { |
|
393 | 393 | $fields=$this->getContentInstances(HtmlFormField::class); |
394 | - foreach ($fields as $field){ |
|
394 | + foreach ($fields as $field) { |
|
395 | 395 | $this->_form->addField($field); |
396 | 396 | } |
397 | 397 | return $this->_form->run($js); |
398 | 398 | } |
399 | 399 | |
400 | - protected function _compileForm(){ |
|
401 | - if(isset($this->_form)){ |
|
400 | + protected function _compileForm() { |
|
401 | + if (isset($this->_form)) { |
|
402 | 402 | $noValidate=""; |
403 | - if(\sizeof($this->_form->getValidationParams())>0) |
|
403 | + if (\sizeof($this->_form->getValidationParams())>0) |
|
404 | 404 | $noValidate="novalidate"; |
405 | - $this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">","</form>"); |
|
405 | + $this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">", "</form>"); |
|
406 | 406 | } |
407 | 407 | } |
408 | 408 | |
@@ -411,26 +411,26 @@ discard block |
||
411 | 411 | return $this; |
412 | 412 | } |
413 | 413 | |
414 | - public function moveFieldTo($from,$to){ |
|
414 | + public function moveFieldTo($from, $to) { |
|
415 | 415 | return $this->_instanceViewer->moveFieldTo($from, $to); |
416 | 416 | } |
417 | 417 | |
418 | - public function swapFields($index1,$index2){ |
|
418 | + public function swapFields($index1, $index2) { |
|
419 | 419 | $index1=$this->_getIndex($index1); |
420 | 420 | $index2=$this->_getIndex($index2); |
421 | 421 | return $this->_instanceViewer->swapFields($index1, $index2); |
422 | 422 | } |
423 | 423 | |
424 | - public function removeField($index){ |
|
424 | + public function removeField($index) { |
|
425 | 425 | $index=$this->_getIndex($index); |
426 | 426 | $this->_instanceViewer->removeField($index); |
427 | 427 | return $this; |
428 | 428 | } |
429 | 429 | |
430 | - public function asModal($header){ |
|
431 | - $modal=new HtmlModal("modal-".$this->identifier,$header); |
|
430 | + public function asModal($header) { |
|
431 | + $modal=new HtmlModal("modal-".$this->identifier, $header); |
|
432 | 432 | $modal->setContent($this); |
433 | - if(isset($this->_form)){ |
|
433 | + if (isset($this->_form)) { |
|
434 | 434 | $this->_form->onSuccess($modal->jsHide()); |
435 | 435 | } |
436 | 436 | return $modal; |
@@ -52,8 +52,9 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function addHeader($title, $niveau=1, $dividing=true) { |
54 | 54 | $header=new HtmlHeader("", $niveau, $title); |
55 | - if ($dividing) |
|
56 | - $header->setDividing(); |
|
55 | + if ($dividing) { |
|
56 | + $header->setDividing(); |
|
57 | + } |
|
57 | 58 | return $this->addItem($header); |
58 | 59 | } |
59 | 60 | |
@@ -74,14 +75,16 @@ discard block |
||
74 | 75 | if (\is_string($end)) { |
75 | 76 | $label=$end; |
76 | 77 | \array_pop($fields); |
77 | - } else |
|
78 | - $label=NULL; |
|
78 | + } else { |
|
79 | + $label=NULL; |
|
80 | + } |
|
79 | 81 | } |
80 | 82 | $this->_fields=\array_merge($this->_fields, $fields); |
81 | 83 | $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields); |
82 | 84 | } |
83 | - if (isset($label)) |
|
84 | - $fields=new HtmlFormField("", $fields, $label); |
|
85 | + if (isset($label)) { |
|
86 | + $fields=new HtmlFormField("", $fields, $label); |
|
87 | + } |
|
85 | 88 | } else { |
86 | 89 | $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count()); |
87 | 90 | } |
@@ -134,27 +137,31 @@ discard block |
||
134 | 137 | */ |
135 | 138 | public function addMessage($identifier, $content, $header=NULL, $icon=NULL, $type=NULL) { |
136 | 139 | $message=new HtmlMessage($identifier, $content); |
137 | - if (isset($header)) |
|
138 | - $message->addHeader($header); |
|
139 | - if (isset($icon)) |
|
140 | - $message->setIcon($icon); |
|
141 | - if (isset($type)) |
|
142 | - $message->setStyle($type); |
|
140 | + if (isset($header)) { |
|
141 | + $message->addHeader($header); |
|
142 | + } |
|
143 | + if (isset($icon)) { |
|
144 | + $message->setIcon($icon); |
|
145 | + } |
|
146 | + if (isset($type)) { |
|
147 | + $message->setStyle($type); |
|
148 | + } |
|
143 | 149 | return $this->addItem($message); |
144 | 150 | } |
145 | 151 | |
146 | 152 | |
147 | 153 | |
148 | 154 | public function compile(JsUtils $js=NULL,&$view=NULL){ |
149 | - if(\sizeof($this->_validationParams)>0) |
|
150 | - $this->setProperty("novalidate", ""); |
|
155 | + if(\sizeof($this->_validationParams)>0) { |
|
156 | + $this->setProperty("novalidate", ""); |
|
157 | + } |
|
151 | 158 | return parent::compile($js,$view); |
152 | 159 | } |
153 | 160 | |
154 | 161 | public function run(JsUtils $js) { |
155 | 162 | if(isset($js)){ |
156 | 163 | $compo=$js->semantic()->form("#".$this->identifier); |
157 | - }else{ |
|
164 | + } else{ |
|
158 | 165 | $compo=new Form(); |
159 | 166 | $compo->attach("#".$this->identifier); |
160 | 167 | } |
@@ -167,8 +174,9 @@ discard block |
||
167 | 174 | if($field instanceof HtmlFormFields){ |
168 | 175 | $items=$field->getItems(); |
169 | 176 | foreach ($items as $_field){ |
170 | - if($_field instanceof HtmlFormField) |
|
171 | - $compo=$this->addCompoValidation($compo, $_field); |
|
177 | + if($_field instanceof HtmlFormField) { |
|
178 | + $compo=$this->addCompoValidation($compo, $_field); |
|
179 | + } |
|
172 | 180 | } |
173 | 181 | } |
174 | 182 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | class HtmlForm extends HtmlSemCollection { |
23 | 23 | |
24 | - use FieldsTrait,FormTrait; |
|
24 | + use FieldsTrait, FormTrait; |
|
25 | 25 | /** |
26 | 26 | * @var array |
27 | 27 | */ |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | |
35 | 35 | public function __construct($identifier, $elements=array()) { |
36 | 36 | parent::__construct($identifier, "form", "ui form"); |
37 | - $this->_states=[ State::ERROR,State::SUCCESS,State::WARNING,State::DISABLED ]; |
|
37 | + $this->_states=[State::ERROR, State::SUCCESS, State::WARNING, State::DISABLED]; |
|
38 | 38 | $this->setProperty("name", $this->identifier); |
39 | - $this->_fields=array (); |
|
39 | + $this->_fields=array(); |
|
40 | 40 | $this->addItems($elements); |
41 | 41 | $this->_validationParams=[]; |
42 | 42 | } |
43 | 43 | |
44 | - protected function getForm(){ |
|
44 | + protected function getForm() { |
|
45 | 45 | return $this; |
46 | 46 | } |
47 | 47 | |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * @param string $caption |
63 | 63 | * @return \Ajax\semantic\html\collections\form\HtmlForm |
64 | 64 | */ |
65 | - public function addDivider($caption=NULL){ |
|
66 | - return $this->addContent(new HtmlDivider("",$caption)); |
|
65 | + public function addDivider($caption=NULL) { |
|
66 | + return $this->addContent(new HtmlDivider("", $caption)); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | public function addFields($fields=NULL, $label=NULL) { |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | $label=NULL; |
80 | 80 | } |
81 | 81 | $this->_fields=\array_merge($this->_fields, $fields); |
82 | - $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields); |
|
82 | + $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(), $fields); |
|
83 | 83 | } |
84 | 84 | if (isset($label)) |
85 | 85 | $fields=new HtmlFormField("", $fields, $label); |
86 | 86 | } else { |
87 | - $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count()); |
|
87 | + $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count()); |
|
88 | 88 | } |
89 | 89 | $this->addItem($fields); |
90 | 90 | return $fields; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | public function addItem($item) { |
94 | 94 | $item=parent::addItem($item); |
95 | - if (\is_subclass_of($item, HtmlFormField::class) === true) { |
|
95 | + if (\is_subclass_of($item, HtmlFormField::class)===true) { |
|
96 | 96 | $this->_fields[]=$item; |
97 | 97 | } |
98 | 98 | return $item; |
@@ -146,39 +146,39 @@ discard block |
||
146 | 146 | |
147 | 147 | |
148 | 148 | |
149 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
150 | - if(\sizeof($this->_validationParams)>0) |
|
149 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
150 | + if (\sizeof($this->_validationParams)>0) |
|
151 | 151 | $this->setProperty("novalidate", ""); |
152 | - return parent::compile($js,$view); |
|
152 | + return parent::compile($js, $view); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | public function run(JsUtils $js) { |
156 | - if(isset($js)){ |
|
156 | + if (isset($js)) { |
|
157 | 157 | $compo=$js->semantic()->form("#".$this->identifier); |
158 | - }else{ |
|
158 | + } else { |
|
159 | 159 | $compo=new Form(); |
160 | 160 | $compo->attach("#".$this->identifier); |
161 | 161 | } |
162 | - foreach ($this->_fields as $field){ |
|
163 | - if($field instanceof HtmlFormField){ |
|
162 | + foreach ($this->_fields as $field) { |
|
163 | + if ($field instanceof HtmlFormField) { |
|
164 | 164 | $compo=$this->addCompoValidation($compo, $field); |
165 | 165 | } |
166 | 166 | } |
167 | - foreach ($this->content as $field){ |
|
168 | - if($field instanceof HtmlFormFields){ |
|
167 | + foreach ($this->content as $field) { |
|
168 | + if ($field instanceof HtmlFormFields) { |
|
169 | 169 | $items=$field->getItems(); |
170 | - foreach ($items as $_field){ |
|
171 | - if($_field instanceof HtmlFormField) |
|
170 | + foreach ($items as $_field) { |
|
171 | + if ($_field instanceof HtmlFormField) |
|
172 | 172 | $compo=$this->addCompoValidation($compo, $_field); |
173 | 173 | } |
174 | 174 | } |
175 | 175 | } |
176 | - $this->_runValidationParams($compo,$js); |
|
176 | + $this->_runValidationParams($compo, $js); |
|
177 | 177 | return $this->_bsComponent; |
178 | 178 | } |
179 | 179 | |
180 | - public function addValidationParam($paramName,$paramValue,$before="",$after=""){ |
|
181 | - $this->addBehavior($this->_validationParams, $paramName, $paramValue,$before,$after); |
|
180 | + public function addValidationParam($paramName, $paramValue, $before="", $after="") { |
|
181 | + $this->addBehavior($this->_validationParams, $paramName, $paramValue, $before, $after); |
|
182 | 182 | return $this; |
183 | 183 | } |
184 | 184 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | return $this->_validationParams; |
192 | 192 | } |
193 | 193 | |
194 | - public function removeValidationParam($param){ |
|
194 | + public function removeValidationParam($param) { |
|
195 | 195 | unset($this->_validationParams[$param]); |
196 | 196 | return $this; |
197 | 197 | } |
@@ -16,6 +16,6 @@ |
||
16 | 16 | if (isset($toElement)) { |
17 | 17 | $toElement->setAttached(true); |
18 | 18 | } |
19 | - return $this->addToPropertyCtrl("class", $side . " attached", Side::getConstantValues("attached")); |
|
19 | + return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached")); |
|
20 | 20 | } |
21 | 21 | } |
22 | 22 | \ No newline at end of file |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace Ajax\semantic\html\collections\table\traits; |
3 | 3 | |
4 | -trait TableTrait{ |
|
4 | +trait TableTrait { |
|
5 | 5 | /** |
6 | 6 | * @return HtmlTable |
7 | 7 | */ |
8 | 8 | abstract protected function getTable(); |
9 | 9 | |
10 | - protected function addToPropertyTable($property,$value){ |
|
10 | + protected function addToPropertyTable($property, $value) { |
|
11 | 11 | return $this->getTable()->addToProperty($property, $value); |
12 | 12 | } |
13 | 13 | |
@@ -18,15 +18,15 @@ discard block |
||
18 | 18 | public function setBasic($very=false) { |
19 | 19 | $table=$this->getTable(); |
20 | 20 | if ($very) |
21 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
22 | - return $table->addToPropertyCtrl("class", "basic", array ("basic" )); |
|
21 | + $table->addToPropertyCtrl("class", "very", array("very")); |
|
22 | + return $table->addToPropertyCtrl("class", "basic", array("basic")); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | public function setCompact($very=false) { |
26 | 26 | $table=$this->getTable(); |
27 | 27 | if ($very) |
28 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
29 | - return $table->addToPropertyCtrl("class", "compact", array ("compact" )); |
|
28 | + $table->addToPropertyCtrl("class", "very", array("very")); |
|
29 | + return $table->addToPropertyCtrl("class", "compact", array("compact")); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public function setCollapsing() { |
@@ -17,15 +17,17 @@ |
||
17 | 17 | |
18 | 18 | public function setBasic($very=false) { |
19 | 19 | $table=$this->getTable(); |
20 | - if ($very) |
|
21 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
20 | + if ($very) { |
|
21 | + $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
22 | + } |
|
22 | 23 | return $table->addToPropertyCtrl("class", "basic", array ("basic" )); |
23 | 24 | } |
24 | 25 | |
25 | 26 | public function setCompact($very=false) { |
26 | 27 | $table=$this->getTable(); |
27 | - if ($very) |
|
28 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
28 | + if ($very) { |
|
29 | + $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
30 | + } |
|
29 | 31 | return $table->addToPropertyCtrl("class", "compact", array ("compact" )); |
30 | 32 | } |
31 | 33 |
@@ -6,8 +6,8 @@ |
||
6 | 6 | public static $preventDefault="\nif(event && event.preventDefault) event.preventDefault();\n"; |
7 | 7 | public static $stopPropagation="\nif(event && event.stopPropagation) event.stopPropagation();\n"; |
8 | 8 | |
9 | - public static function containsCode($expression){ |
|
10 | - return strrpos($expression, 'this')!==false||strrpos($expression, 'event')!==false||strrpos($expression, 'self')!==false; |
|
9 | + public static function containsCode($expression) { |
|
10 | + return strrpos($expression, 'this')!==false || strrpos($expression, 'event')!==false || strrpos($expression, 'self')!==false; |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | /** |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | } |
14 | 14 | |
15 | 15 | public function setClass($classNames) { |
16 | - if(\is_array($classNames)){ |
|
16 | + if (\is_array($classNames)) { |
|
17 | 17 | $classNames=implode(" ", $classNames); |
18 | 18 | } |
19 | 19 | $this->setProperty("class", $classNames); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | } |
22 | 22 | |
23 | 23 | public function addClass($classNames) { |
24 | - if(\is_array($classNames)){ |
|
24 | + if (\is_array($classNames)) { |
|
25 | 25 | $classNames=implode(" ", $classNames); |
26 | 26 | } |
27 | 27 | $this->addToProperty("class", $classNames); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function fromArray($array) { |
54 | 54 | $array=parent::fromArray($array); |
55 | - foreach ( $array as $key => $value ) { |
|
55 | + foreach ($array as $key => $value) { |
|
56 | 56 | $this->setProperty($key, $value); |
57 | 57 | } |
58 | 58 | return $array; |
@@ -8,12 +8,12 @@ discard block |
||
8 | 8 | * @author jc |
9 | 9 | * |
10 | 10 | */ |
11 | -trait BaseHtmlPropertiesTrait{ |
|
11 | +trait BaseHtmlPropertiesTrait { |
|
12 | 12 | |
13 | - protected $properties=array (); |
|
13 | + protected $properties=array(); |
|
14 | 14 | abstract protected function ctrl($name, $value, $typeCtrl); |
15 | 15 | abstract protected function removeOldValues(&$oldValue, $allValues); |
16 | - abstract protected function _getElementBy($callback,$elements); |
|
16 | + abstract protected function _getElementBy($callback, $elements); |
|
17 | 17 | public function getProperties() { |
18 | 18 | return $this->properties; |
19 | 19 | } |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | |
40 | 40 | public function addToProperty($name, $value, $separator=" ") { |
41 | 41 | if (\is_array($value)) { |
42 | - foreach ( $value as $v ) { |
|
42 | + foreach ($value as $v) { |
|
43 | 43 | $this->addToProperty($name, $v, $separator); |
44 | 44 | } |
45 | - } else if ($value !== "" && $this->propertyContains($name, $value) === false) { |
|
45 | + } else if ($value!=="" && $this->propertyContains($name, $value)===false) { |
|
46 | 46 | $v=@$this->properties[$name]; |
47 | - if (isset($v) && $v !== "") |
|
48 | - $v=$v . $separator . $value; |
|
47 | + if (isset($v) && $v!=="") |
|
48 | + $v=$v.$separator.$value; |
|
49 | 49 | else |
50 | 50 | $v=$value; |
51 | 51 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | public function addToPropertyCtrlCheck($name, $value, $typeCtrl) { |
86 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
86 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
87 | 87 | return $this->addToProperty($name, $value); |
88 | 88 | } |
89 | 89 | return $this; |
@@ -104,12 +104,12 @@ discard block |
||
104 | 104 | } |
105 | 105 | |
106 | 106 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
107 | - if ($this->ctrl($name, $value, $typeCtrl) === true) |
|
107 | + if ($this->ctrl($name, $value, $typeCtrl)===true) |
|
108 | 108 | return $this->setProperty($name, $value); |
109 | 109 | return $this; |
110 | 110 | } |
111 | 111 | |
112 | - protected function getElementByPropertyValue($propertyName,$value, $elements) { |
|
113 | - return $this->_getElementBy(function($element) use ($propertyName,$value){return $element->propertyContains($propertyName, $value) === true;}, $elements); |
|
112 | + protected function getElementByPropertyValue($propertyName, $value, $elements) { |
|
113 | + return $this->_getElementBy(function($element) use ($propertyName, $value){return $element->propertyContains($propertyName, $value)===true; }, $elements); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | \ No newline at end of file |
@@ -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 |