Completed
Push — master ( 84f5b5...fd30d0 )
by Jean-Christophe
03:25
created
Ajax/semantic/html/content/table/HtmlTableContent.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  *
12 12
  */
13 13
 class HtmlTableContent extends HtmlSemCollection {
14
-	protected $_tdTagNames=[ "thead" => "th","tbody" => "td","tfoot" => "th" ];
14
+	protected $_tdTagNames=["thead" => "th", "tbody" => "td", "tfoot" => "th"];
15 15
 
16 16
 	/**
17 17
 	 *
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public function setRowCount($rowCount, $colCount) {
36 36
 		$count=$this->count();
37
-		for($i=$count; $i < $rowCount; $i++) {
37
+		for ($i=$count; $i<$rowCount; $i++) {
38 38
 			$this->addItem($colCount);
39 39
 		}
40 40
 		return $this;
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		$tr=new HtmlTR("", $value);
57 57
 		$tr->setContainer($this, $count);
58 58
 		$tr->setTdTagName($this->_tdTagNames[$this->tagName]);
59
-		if (isset($value) === true) {
59
+		if (isset($value)===true) {
60 60
 			$tr->setColCount($value);
61 61
 		}
62 62
 		return $tr;
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	public function setCellValue($row, $col, $value="") {
116 116
 		$cell=$this->getCell($row, $col);
117
-		if (isset($cell) === true) {
117
+		if (isset($cell)===true) {
118 118
 			$cell->setValue($value);
119 119
 		}
120 120
 		return $this;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 * @param mixed $values
126 126
 	 */
127 127
 	public function setValues($values=array()) {
128
-		return $this->_addOrSetValues($values, function(HtmlTR $row,$_values){$row->setValues($_values);});
128
+		return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) {$row->setValues($_values); });
129 129
 	}
130 130
 
131 131
 	/**
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @param mixed $values
134 134
 	 */
135 135
 	public function addValues($values=array()) {
136
-		return $this->_addOrSetValues($values, function(HtmlTR $row,$_values){$row->addValues($_values);});
136
+		return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) {$row->addValues($_values); });
137 137
 	}
138 138
 
139 139
 	/**
@@ -141,21 +141,21 @@  discard block
 block discarded – undo
141 141
 	 * @param mixed $values
142 142
 	 * @param callable $callback
143 143
 	 */
144
-	protected function _addOrSetValues($values,$callback) {
144
+	protected function _addOrSetValues($values, $callback) {
145 145
 		$count=$this->count();
146 146
 		$isArray=true;
147 147
 		if (!\is_array($values)) {
148 148
 			$values=\array_fill(0, $count, $values);
149 149
 			$isArray=false;
150 150
 		}
151
-		if (JArray::dimension($values) == 1 && $isArray)
152
-			$values=[ $values ];
151
+		if (JArray::dimension($values)==1 && $isArray)
152
+			$values=[$values];
153 153
 
154 154
 		$count=\min(\sizeof($values), $count);
155 155
 
156
-		for($i=0; $i < $count; $i++) {
156
+		for ($i=0; $i<$count; $i++) {
157 157
 			$row=$this->content[$i];
158
-			$callback($row,$values[$i]);
158
+			$callback($row, $values[$i]);
159 159
 		}
160 160
 		return $this;
161 161
 	}
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 			$values=\array_fill(0, $count, $values);
167 167
 		}
168 168
 		$count=\min(\sizeof($values), $count);
169
-		for($i=0; $i < $count; $i++) {
169
+		for ($i=0; $i<$count; $i++) {
170 170
 			$this->getCell($i, $colIndex)->setValue($values[$i]);
171 171
 		}
172 172
 		return $this;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
 	public function addColVariations($colIndex, $variations=array()) {
176 176
 		$count=$this->count();
177
-		for($i=0; $i < $count; $i++) {
177
+		for ($i=0; $i<$count; $i++) {
178 178
 			$this->getCell($i, $colIndex)->addVariations($variations);
179 179
 		}
180 180
 		return $this;
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
 
192 192
 	private function colAlign($colIndex, $function) {
193 193
 		$count=$this->count();
194
-		for($i=0; $i < $count; $i++) {
194
+		for ($i=0; $i<$count; $i++) {
195 195
 			$index=$this->content[$i]->getColPosition($colIndex);
196
-			if ($index !== NULL)
196
+			if ($index!==NULL)
197 197
 				$this->getCell($i, $index)->$function();
198 198
 		}
199 199
 		return $this;
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	 */
226 226
 	public function getColCount() {
227 227
 		$result=0;
228
-		if ($this->count() > 0)
228
+		if ($this->count()>0)
229 229
 			$result=$this->getItem(0)->count();
230 230
 		return $result;
231 231
 	}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	public function delete($rowIndex, $colIndex=NULL) {
240 240
 		if (isset($colIndex)) {
241 241
 			$row=$this->getItem($rowIndex);
242
-			if (isset($row) === true) {
242
+			if (isset($row)===true) {
243 243
 				$row->delete($colIndex);
244 244
 			}
245 245
 		} else {
@@ -272,17 +272,17 @@  discard block
 block discarded – undo
272 272
 	 */
273 273
 	public function conditionalCellFormat($callback, $format) {
274 274
 		$rows=$this->content;
275
-		foreach ( $rows as $row ) {
275
+		foreach ($rows as $row) {
276 276
 			$row->conditionalCellFormat($callback, $format);
277 277
 		}
278 278
 		return $this;
279 279
 	}
280 280
 
281
-	public function conditionalColFormat($colIndex,$callback,$format){
281
+	public function conditionalColFormat($colIndex, $callback, $format) {
282 282
 		$rows=$this->content;
283
-		foreach ( $rows as $row ) {
283
+		foreach ($rows as $row) {
284 284
 			$cell=$row->getItem($colIndex);
285
-			$cell->conditionnalCellFormat($callback,$format);
285
+			$cell->conditionnalCellFormat($callback, $format);
286 286
 		}
287 287
 		return $this;
288 288
 	}
@@ -294,17 +294,17 @@  discard block
 block discarded – undo
294 294
 	 */
295 295
 	public function conditionalRowFormat($callback, $format) {
296 296
 		$rows=$this->content;
297
-		foreach ( $rows as $row ) {
297
+		foreach ($rows as $row) {
298 298
 			$row->conditionalRowFormat($callback, $format);
299 299
 		}
300 300
 		return $this;
301 301
 	}
302 302
 
303
-	public function hideColumn($colIndex){
303
+	public function hideColumn($colIndex) {
304 304
 		$rows=$this->content;
305
-		foreach ( $rows as $row ) {
305
+		foreach ($rows as $row) {
306 306
 			$cell=$row->getItem($colIndex);
307
-			$cell->addToProperty("style","display:none;");
307
+			$cell->addToProperty("style", "display:none;");
308 308
 		}
309 309
 		return $this;
310 310
 	}
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	 */
316 316
 	public function applyCells($callback) {
317 317
 		$rows=$this->content;
318
-		foreach ( $rows as $row ) {
318
+		foreach ($rows as $row) {
319 319
 			$row->applyCells($callback);
320 320
 		}
321 321
 		return $this;
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	 */
328 328
 	public function applyRows($callback) {
329 329
 		$rows=$this->content;
330
-		foreach ( $rows as $row ) {
330
+		foreach ($rows as $row) {
331 331
 			$row->apply($callback);
332 332
 		}
333 333
 		return $this;
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/HtmlBreadcrumb.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		$this->startIndex=$startIndex;
53 53
 		$this->autoActive=$autoActive;
54 54
 		$this->_contentSeparator="<div class='divider'> / </div>";
55
-		$this->_hrefFunction=function (HtmlSemDoubleElement $e) {
55
+		$this->_hrefFunction=function(HtmlSemDoubleElement $e) {
56 56
 			return $e->getContent();
57 57
 		};
58 58
 		if (isset($hrefFunction)) {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @return HtmlBreadcrumbs
69 69
 	 */
70 70
 	public function autoGetOnClick($targetSelector) {
71
-		return $this->getOnClick($this->root, $targetSelector, array ("attr" => $this->attr ));
71
+		return $this->getOnClick($this->root, $targetSelector, array("attr" => $this->attr));
72 72
 	}
73 73
 
74 74
 	public function contentAsString() {
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function setActive($index=null) {
85 85
 		if (!isset($index)) {
86
-			$index=sizeof($this->content) - 1;
86
+			$index=sizeof($this->content)-1;
87 87
 		}
88 88
 		$activeItem=$this->content[$index];
89 89
 		$activeItem->addToProperty("class", "active");
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 * @param Dispatcher $dispatcher the request dispatcher
97 97
 	 * @return \Ajax\bootstrap\html\HtmlBreadcrumbs
98 98
 	 */
99
-	public function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0) {
99
+	public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) {
100 100
 		return $this->addItems($js->fromDispatcher($dispatcher));
101 101
 	}
102 102
 
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
 		if (!isset($index)) {
111 111
 			$index=sizeof($this->content);
112 112
 		}
113
-		if ($this->absolutePaths === true) {
113
+		if ($this->absolutePaths===true) {
114 114
 			return $this->_hrefFunction($this->content[$index]);
115 115
 		} else {
116
-			return $this->root . implode($separator, array_slice(array_map(function ($e) {
116
+			return $this->root.implode($separator, array_slice(array_map(function($e) {
117 117
 				return $this->_hrefFunction($e);
118
-			}, $this->content), $this->startIndex, $index + 1));
118
+			}, $this->content), $this->startIndex, $index+1));
119 119
 		}
120 120
 	}
121 121
 
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 			$this->setActive();
150 150
 		}
151 151
 		$count=$this->count();
152
-		for($i=1; $i < $count; $i++) {
153
-			$this->content[$i]->wrap($this->getContentDivider($i - 1));
152
+		for ($i=1; $i<$count; $i++) {
153
+			$this->content[$i]->wrap($this->getContentDivider($i-1));
154 154
 		}
155 155
 		return parent::compile($js, $view);
156 156
 	}
@@ -160,15 +160,15 @@  discard block
 block discarded – undo
160 160
 	 * @see \Ajax\bootstrap\html\base\BaseHtml::on()
161 161
 	 */
162 162
 	public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) {
163
-		foreach ( $this->content as $element ) {
163
+		foreach ($this->content as $element) {
164 164
 			$element->on($event, $jsCode, $stopPropagation, $preventDefault);
165 165
 		}
166 166
 		return $this;
167 167
 	}
168 168
 
169 169
 	public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) {
170
-		foreach ( $this->content as $element ) {
171
-			if ($element->getProperty($this->attr) != NULL){
170
+		foreach ($this->content as $element) {
171
+			if ($element->getProperty($this->attr)!=NULL) {
172 172
 				$element->_ajaxOn($operation, $event, $url, $responseElement, $parameters);
173 173
 			}
174 174
 		}
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	protected function createItem($value) {
185 185
 		$count=$this->count();
186
-		$itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section");
186
+		$itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section");
187 187
 		if (\is_array($value))
188 188
 			$itemO->fromArray($value);
189 189
 		else {
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	public function addIconAt($icon, $index) {
196 196
 		$item=$this->getItem($index);
197 197
 		if (isset($item)) {
198
-			$icon=new HtmlIcon("icon-" . $this->identifier, $icon);
198
+			$icon=new HtmlIcon("icon-".$this->identifier, $icon);
199 199
 			$item->wrapContent($icon);
200 200
 		}
201 201
 	}
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	public function addItem($item) {
204 204
 		$count=$this->count();
205 205
 		$itemO=parent::addItem($item);
206
-		$this->addToPropertyCtrl("class", "section", array ("section" ));
206
+		$this->addToPropertyCtrl("class", "section", array("section"));
207 207
 		$itemO->setProperty($this->attr, $this->getHref($count));
208 208
 		return $itemO;
209 209
 	}
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 	public function setAbsolutePaths($absolutePaths) {
220 220
 		$this->absolutePaths=$absolutePaths;
221 221
 		$size=\sizeof($this->content);
222
-		for($i=0;$i<$size;$i++){
222
+		for ($i=0; $i<$size; $i++) {
223 223
 			$this->content[$i]->setProperty($this->attr, $this->getHref($i));
224 224
 		}
225 225
 		return $this;
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/traits/FormTrait.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -14,27 +14,27 @@  discard block
 block discarded – undo
14 14
  * @author jc
15 15
  *
16 16
  */
17
-trait FormTrait{
17
+trait FormTrait {
18 18
 
19 19
 	/**
20 20
 	 * @return HtmlForm
21 21
 	 */
22 22
 	abstract protected function getForm();
23 23
 
24
-	protected function addCompoValidation(Form $compo,HtmlFormField $field){
24
+	protected function addCompoValidation(Form $compo, HtmlFormField $field) {
25 25
 		$validation=$field->getValidation();
26
-		if(isset($validation)){
26
+		if (isset($validation)) {
27 27
 			$validation->setIdentifier($field->getDataField()->getIdentifier());
28 28
 			$compo->addFieldValidation($validation);
29 29
 		}
30 30
 		return $compo;
31 31
 	}
32 32
 
33
-	protected function _runValidationParams(Form &$compo,JsUtils $js=NULL){
33
+	protected function _runValidationParams(Form&$compo, JsUtils $js=NULL) {
34 34
 		$form=$this->getForm();
35 35
 		$params=$form->getValidationParams();
36
-		if(isset($params["_ajaxSubmit"])){
37
-			$compilation=$this->_compileAjaxSubmit($params["_ajaxSubmit"],$js);
36
+		if (isset($params["_ajaxSubmit"])) {
37
+			$compilation=$this->_compileAjaxSubmit($params["_ajaxSubmit"], $js);
38 38
 			$this->onSuccess($compilation);
39 39
 			$form->removeValidationParam("_ajaxSubmit");
40 40
 		}
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 		$form->addEventsOnRun($js);
44 44
 	}
45 45
 
46
-	protected function _compileAjaxSubmit($ajaxSubmit,JsUtils $js=null){
46
+	protected function _compileAjaxSubmit($ajaxSubmit, JsUtils $js=null) {
47 47
 		$compilation="";
48
-		if(\is_array($ajaxSubmit)){
49
-			foreach ($ajaxSubmit as $ajaxSubmitItem){
48
+		if (\is_array($ajaxSubmit)) {
49
+			foreach ($ajaxSubmit as $ajaxSubmitItem) {
50 50
 				$compilation.=$ajaxSubmitItem->compile($js);
51 51
 			}
52
-		}elseif($ajaxSubmit instanceof AjaxCall){
52
+		}elseif ($ajaxSubmit instanceof AjaxCall) {
53 53
 			$compilation=$ajaxSubmit->compile($js);
54 54
 		}
55
-		$compilation=str_ireplace("\"","%quote%", $compilation);
55
+		$compilation=str_ireplace("\"", "%quote%", $compilation);
56 56
 		return $compilation;
57 57
 	}
58 58
 
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
 		return $this;
66 66
 	}
67 67
 
68
-	public function setAttached($value=true){
68
+	public function setAttached($value=true) {
69 69
 		$form=$this->getForm();
70
-		if($value)
71
-			$form->addToPropertyCtrl("class", "attached", array ("attached" ));
70
+		if ($value)
71
+			$form->addToPropertyCtrl("class", "attached", array("attached"));
72 72
 		return $form;
73 73
 	}
74 74
 
75
-	public function addErrorMessage(){
75
+	public function addErrorMessage() {
76 76
 		return $this->getForm()->addContent((new HtmlMessage(""))->setError());
77 77
 	}
78 78
 
@@ -88,47 +88,47 @@  discard block
 block discarded – undo
88 88
 	 * @param array $parameters
89 89
 	 * @return HtmlForm
90 90
 	 */
91
-	public function submitOn($event,$identifierOrElement,$url,$responseElement,$parameters=NULL){
91
+	public function submitOn($event, $identifierOrElement, $url, $responseElement, $parameters=NULL) {
92 92
 		$form=$this->getForm();
93
-		if($identifierOrElement  instanceof BaseHtml)
93
+		if ($identifierOrElement  instanceof BaseHtml)
94 94
 			$elem=$identifierOrElement;
95 95
 		else
96 96
 			$elem=$form->getElementById($identifierOrElement, $form->getContent());
97
-		if(isset($elem)){
98
-			$this->_buttonAsSubmit($elem, $event,$url,$responseElement,$parameters);
97
+		if (isset($elem)) {
98
+			$this->_buttonAsSubmit($elem, $event, $url, $responseElement, $parameters);
99 99
 		}
100 100
 		return $form;
101 101
 	}
102 102
 
103
-	public function submitOnClick($identifier,$url,$responseElement,$parameters=NULL){
104
-		return $this->submitOn("click", $identifier, $url, $responseElement,$parameters);
103
+	public function submitOnClick($identifier, $url, $responseElement, $parameters=NULL) {
104
+		return $this->submitOn("click", $identifier, $url, $responseElement, $parameters);
105 105
 	}
106 106
 
107
-	public function addSubmit($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){
108
-		$bt=$this->getForm()->addButton($identifier, $value,$cssStyle);
109
-		return $this->_buttonAsSubmit($bt, "click",$url,$responseElement,$parameters);
107
+	public function addSubmit($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) {
108
+		$bt=$this->getForm()->addButton($identifier, $value, $cssStyle);
109
+		return $this->_buttonAsSubmit($bt, "click", $url, $responseElement, $parameters);
110 110
 	}
111 111
 
112
-	protected function _buttonAsSubmit(BaseHtml &$button,$event,$url,$responseElement=NULL,$parameters=NULL){
112
+	protected function _buttonAsSubmit(BaseHtml&$button, $event, $url, $responseElement=NULL, $parameters=NULL) {
113 113
 		$form=$this->getForm();
114
-		if(isset($url) && isset($responseElement)){
115
-			$button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');",true,true);
116
-			$this->setSubmitParams($url,$responseElement,$parameters);
114
+		if (isset($url) && isset($responseElement)) {
115
+			$button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');", true, true);
116
+			$this->setSubmitParams($url, $responseElement, $parameters);
117 117
 		}
118 118
 		return $button;
119 119
 	}
120 120
 
121
-	public function setSubmitParams($url,$responseElement=NULL,$parameters=NULL){
121
+	public function setSubmitParams($url, $responseElement=NULL, $parameters=NULL) {
122 122
 		$form=$this->getForm();
123
-		$params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url,"stopPropagation"=>true];
124
-		if(\is_array($parameters))
125
-			$params=\array_merge($params,$parameters);
123
+		$params=["form"=>$form->getIdentifier(), "responseElement"=>$responseElement, "url"=>$url, "stopPropagation"=>true];
124
+		if (\is_array($parameters))
125
+			$params=\array_merge($params, $parameters);
126 126
 		$form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params));
127 127
 		return $this;
128 128
 	}
129 129
 
130
-	public function addReset($identifier,$value,$cssStyle=NULL){
131
-		$bt=$this->getForm()->addButton($identifier, $value,$cssStyle);
130
+	public function addReset($identifier, $value, $cssStyle=NULL) {
131
+		$bt=$this->getForm()->addButton($identifier, $value, $cssStyle);
132 132
 		$bt->setProperty("type", "reset");
133 133
 		return $bt;
134 134
 	}
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 * @param string $jsCode
139 139
 	 * @return \Ajax\semantic\html\collections\form\HtmlForm
140 140
 	 */
141
-	public function onValid($jsCode){
141
+	public function onValid($jsCode) {
142 142
 		$form=$this->getForm();
143 143
 		$form->addValidationParam("onValid", "%function(){".$jsCode."}%");
144 144
 		return $form;
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
 	 * @param string $jsCode can use event and fields parameters
150 150
 	 * @return HtmlForm
151 151
 	 */
152
-	public function onSuccess($jsCode){
152
+	public function onSuccess($jsCode) {
153 153
 		$form=$this->getForm();
154
-		$form->addValidationParam("onSuccess", $jsCode,"%function(event,fields){","}%");
154
+		$form->addValidationParam("onSuccess", $jsCode, "%function(event,fields){", "}%");
155 155
 		return $form;
156 156
 	}
157 157
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/base/traits/BaseTrait.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
  * @property HtmlSemDoubleElement $_self
16 16
  */
17 17
 trait BaseTrait {
18
-	protected $_variations=[ ];
19
-	protected $_states=[ ];
18
+	protected $_variations=[];
19
+	protected $_states=[];
20 20
 	protected $_baseClass;
21 21
 
22 22
 	abstract protected function setPropertyCtrl($name, $value, $typeCtrl);
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
 	abstract public function setProperty($name, $value);
31 31
 
32
-	abstract public function addContent($content,$before=false);
32
+	abstract public function addContent($content, $before=false);
33 33
 
34 34
 	abstract public function onCreate($jsCode);
35 35
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		$this->_self->setProperty("class", $this->_self->getBaseClass());
51 51
 		if (\is_string($variations))
52 52
 			$variations=\explode(" ", $variations);
53
-		foreach ( $variations as $variation ) {
53
+		foreach ($variations as $variation) {
54 54
 			$this->_self->addVariation($variation);
55 55
 		}
56 56
 		return $this;
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	public function addVariations($variations=array()) {
65 65
 		if (\is_string($variations))
66 66
 			$variations=\explode(" ", $variations);
67
-		foreach ( $variations as $variation ) {
67
+		foreach ($variations as $variation) {
68 68
 			$this->_self->addVariation($variation);
69 69
 		}
70 70
 		return $this;
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	public function addStates($states=array()) {
74 74
 		if (\is_string($states))
75 75
 			$states=\explode(" ", $states);
76
-		foreach ( $states as $state ) {
76
+		foreach ($states as $state) {
77 77
 			$this->_self->addState($state);
78 78
 		}
79 79
 		return $this;
@@ -83,17 +83,17 @@  discard block
 block discarded – undo
83 83
 		$this->_self->setProperty("class", $this->_self->getBaseClass());
84 84
 		if (\is_string($states))
85 85
 			$states=\explode(" ", $states);
86
-		foreach ( $states as $state ) {
86
+		foreach ($states as $state) {
87 87
 			$this->_self->addState($state);
88 88
 		}
89 89
 		return $this;
90 90
 	}
91 91
 
92 92
 	public function addIcon($icon, $before=true) {
93
-		return $this->_self->addContent(new HtmlIcon("icon-" . $this->_self->getIdentifier(), $icon), $before);
93
+		return $this->_self->addContent(new HtmlIcon("icon-".$this->_self->getIdentifier(), $icon), $before);
94 94
 	}
95 95
 
96
-	public function addSticky($context="body"){
96
+	public function addSticky($context="body") {
97 97
 		$this->_self->onCreate("$('#".$this->_self->getIdentifier()."').sticky({ context: '".$context."'});");
98 98
 		return $this;
99 99
 	}
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 * @return HtmlSemDoubleElement
115 115
 	 */
116 116
 	public function setDisabled($disable=true) {
117
-		if($disable)
117
+		if ($disable)
118 118
 			$this->_self->addToProperty("class", "disabled");
119 119
 		return $this;
120 120
 	}
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	 *
141 141
 	 * @return HtmlSemDoubleElement
142 142
 	 */
143
-	public function asHeader(){
143
+	public function asHeader() {
144 144
 		return $this->_self->addToProperty("class", "header");
145 145
 	}
146 146
 
@@ -148,15 +148,15 @@  discard block
 block discarded – undo
148 148
 	 * show it is currently the active user selection
149 149
 	 * @return HtmlSemDoubleElement
150 150
 	 */
151
-	public function setActive($value=true){
152
-		if($value)
151
+	public function setActive($value=true) {
152
+		if ($value)
153 153
 			$this->_self->addToProperty("class", "active");
154 154
 		return $this;
155 155
 	}
156 156
 
157
-	public function setAttached($value=true){
158
-		if($value)
159
-			$this->_self->addToPropertyCtrl("class", "attached", array ("attached" ));
157
+	public function setAttached($value=true) {
158
+		if ($value)
159
+			$this->_self->addToPropertyCtrl("class", "attached", array("attached"));
160 160
 		return $this;
161 161
 	}
162 162
 
@@ -164,13 +164,13 @@  discard block
 block discarded – undo
164 164
 	 * can be formatted to appear on dark backgrounds
165 165
 	 */
166 166
 	public function setInverted($recursive=true) {
167
-		if($recursive===true){
167
+		if ($recursive===true) {
168 168
 			$content=$this->_self->getContent();
169
-			if($content instanceof HtmlSemDoubleElement)
169
+			if ($content instanceof HtmlSemDoubleElement)
170 170
 				$content->setInverted($recursive);
171
-			elseif(\is_array($content) || $content instanceof \Traversable){
172
-				foreach ($content as $elm){
173
-					if($elm instanceof  HtmlSemDoubleElement){
171
+			elseif (\is_array($content) || $content instanceof \Traversable) {
172
+				foreach ($content as $elm) {
173
+					if ($elm instanceof  HtmlSemDoubleElement) {
174 174
 						$elm->setInverted($recursive);
175 175
 					}
176 176
 				}
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	}
185 185
 
186 186
 	public function setFloated($direction="right") {
187
-		return $this->_self->addToPropertyCtrl("class", $direction . " floated", Direction::getConstantValues("floated"));
187
+		return $this->_self->addToPropertyCtrl("class", $direction." floated", Direction::getConstantValues("floated"));
188 188
 	}
189 189
 
190 190
 	public function floatRight() {
@@ -199,14 +199,14 @@  discard block
 block discarded – undo
199 199
 		return $this->_baseClass;
200 200
 	}
201 201
 
202
-	protected function addBehavior(&$array,$key,$value,$before="",$after=""){
203
-		if(\is_string($value)){
204
-			if(isset($array[$key])){
202
+	protected function addBehavior(&$array, $key, $value, $before="", $after="") {
203
+		if (\is_string($value)) {
204
+			if (isset($array[$key])) {
205 205
 				$p=JString::replaceAtFirstAndLast($array[$key], $before, "", $after, "");
206 206
 				$array[$key]=$before.$p.$value.$after;
207
-			}else
207
+			} else
208 208
 				$array[$key]=$before.$value.$after;
209
-		}else{
209
+		} else {
210 210
 			$array[$key]=$value;
211 211
 		}
212 212
 		return $this;
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsInternalTrait.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@  discard block
 block discarded – undo
2 2
 namespace Ajax\common\traits;
3 3
 use Ajax\common\BaseGui;
4 4
 
5
-trait JsUtilsInternalTrait{
5
+trait JsUtilsInternalTrait {
6 6
 
7
-	protected $jquery_code_for_compile=array ();
7
+	protected $jquery_code_for_compile=array();
8 8
 
9 9
 	protected function _addToCompile($jsScript) {
10 10
 		$this->jquery_code_for_compile[]=$jsScript;
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
 	 * @param BaseGui $library
15 15
 	 * @param mixed $view
16 16
 	 */
17
-	protected function _compileLibrary(BaseGui $library=NULL, &$view=NULL){
17
+	protected function _compileLibrary(BaseGui $library=NULL, &$view=NULL) {
18 18
 		if ($library!=NULL) {
19
-			if(isset($view))
19
+			if (isset($view))
20 20
 				$library->compileHtml($this, $view);
21 21
 			if ($library->isAutoCompile()) {
22 22
 				$library->compile(true);
@@ -24,20 +24,20 @@  discard block
 block discarded – undo
24 24
 		}
25 25
 	}
26 26
 
27
-	protected function defer($script){
27
+	protected function defer($script) {
28 28
 		$result="window.defer=function (method) {if (window.jQuery) method(); else setTimeout(function() { defer(method) }, 50);};";
29 29
 		$result.="window.defer(function(){".$script."})";
30 30
 		return $result;
31 31
 	}
32 32
 
33
-	protected function ready($script){
33
+	protected function ready($script) {
34 34
 		$result='$(document).ready(function() {'."\n";
35 35
 		$result.=$script.'})';
36 36
 		return $result;
37 37
 	}
38 38
 
39 39
 	protected function minify($input) {
40
-		if(trim($input) === "") return $input;
40
+		if (trim($input)==="") return $input;
41 41
 		return preg_replace(
42 42
 				array(
43 43
 						// Remove comment(s)
Please login to merge, or discard this patch.
Ajax/common/html/traits/BaseHtmlPropertiesTrait.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,12 +9,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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(BaseHtml $element) use ($propertyName,$value){return $element->propertyContains($propertyName, $value) === true;}, $elements);
113
+	protected function getElementByPropertyValue($propertyName, $value, $elements) {
114
+		return $this->_self->_getElementBy(function(BaseHtml $element) use ($propertyName, $value){return $element->propertyContains($propertyName, $value)===true; }, $elements);
115 115
 	}
116 116
 }
Please login to merge, or discard this patch.
Ajax/common/html/BaseHtml.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
  * @version 1.3
16 16
  */
17 17
 abstract class BaseHtml extends BaseWidget {
18
-	use BaseHtmlEventsTrait,BaseHtmlPropertiesTrait;
18
+	use BaseHtmlEventsTrait, BaseHtmlPropertiesTrait;
19 19
 	protected $_template;
20 20
 	protected $tagName;
21
-	protected $_wrapBefore=array ();
22
-	protected $_wrapAfter=array ();
21
+	protected $_wrapBefore=array();
22
+	protected $_wrapAfter=array();
23 23
 	protected $_bsComponent;
24 24
 	protected $_compiled=false;
25 25
 
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	abstract public function run(JsUtils $js);
32 32
 
33
-	private function _callSetter($setter,$key,$value,&$array){
33
+	private function _callSetter($setter, $key, $value, &$array) {
34 34
 		$result=false;
35 35
 		if (method_exists($this, $setter) && !JString::startswith($key, "_")) {
36 36
 			try {
37 37
 				$this->$setter($value);
38 38
 				unset($array[$key]);
39 39
 				$result=true;
40
-			} catch ( \Exception $e ) {
40
+			}catch (\Exception $e) {
41 41
 				$result=false;
42 42
 			}
43 43
 		}
@@ -45,17 +45,17 @@  discard block
 block discarded – undo
45 45
 	}
46 46
 
47 47
 	protected function getTemplate(JsUtils $js=NULL) {
48
-		return PropertyWrapper::wrap($this->_wrapBefore, $js) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js);
48
+		return PropertyWrapper::wrap($this->_wrapBefore, $js).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js);
49 49
 	}
50 50
 
51 51
 	protected function ctrl($name, $value, $typeCtrl) {
52 52
 		if (\is_array($typeCtrl)) {
53
-			if (array_search($value, $typeCtrl) === false) {
54
-				throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}");
53
+			if (array_search($value, $typeCtrl)===false) {
54
+				throw new \Exception("La valeur passée `".$value."` à la propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
55 55
 			}
56 56
 		} else {
57 57
 			if (!$typeCtrl($value)) {
58
-				throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name);
58
+				throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name);
59 59
 			}
60 60
 		}
61 61
 		return true;
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
 
66 66
 	protected function setMemberCtrl(&$name, $value, $typeCtrl) {
67
-		if ($this->ctrl($name, $value, $typeCtrl) === true) {
67
+		if ($this->ctrl($name, $value, $typeCtrl)===true) {
68 68
 			return $name=$value;
69 69
 		}
70 70
 		return $this;
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") {
74 74
 		if (\is_array($typeCtrl)) {
75 75
 			$this->removeOldValues($name, $typeCtrl);
76
-			$name.=$separator . $value;
76
+			$name.=$separator.$value;
77 77
 		}
78 78
 		return $this;
79 79
 	}
@@ -81,17 +81,17 @@  discard block
 block discarded – undo
81 81
 
82 82
 
83 83
 	protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") {
84
-		if ($this->ctrl($name, $value, $typeCtrl) === true) {
84
+		if ($this->ctrl($name, $value, $typeCtrl)===true) {
85 85
 			if (\is_array($typeCtrl)) {
86 86
 				$this->removeOldValues($name, $typeCtrl);
87 87
 			}
88
-			$name.=$separator . $value;
88
+			$name.=$separator.$value;
89 89
 		}
90 90
 		return $this;
91 91
 	}
92 92
 
93 93
 	protected function addToMember(&$name, $value, $separator=" ") {
94
-		$name=str_ireplace($value, "", $name) . $separator . $value;
94
+		$name=str_ireplace($value, "", $name).$separator.$value;
95 95
 		return $this;
96 96
 	}
97 97
 
@@ -102,18 +102,18 @@  discard block
 block discarded – undo
102 102
 		$oldValue=trim($oldValue);
103 103
 	}
104 104
 
105
-	protected function _getElementBy($callback,$elements){
105
+	protected function _getElementBy($callback, $elements) {
106 106
 		if (\is_array($elements)) {
107 107
 			$elements=\array_values($elements);
108 108
 			$flag=false;
109 109
 			$index=0;
110
-			while ( !$flag && $index < sizeof($elements) ) {
110
+			while (!$flag && $index<sizeof($elements)) {
111 111
 				if ($elements[$index] instanceof BaseHtml)
112 112
 					$flag=($callback($elements[$index]));
113 113
 					$index++;
114 114
 			}
115
-			if ($flag === true)
116
-				return $elements[$index - 1];
115
+			if ($flag===true)
116
+				return $elements[$index-1];
117 117
 		} elseif ($elements instanceof BaseHtml) {
118 118
 			if ($callback($elements))
119 119
 				return $elements;
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
 	}
142 142
 
143 143
 	public function fromArray($array) {
144
-		foreach ( $this as $key => $value ) {
145
-			if(array_key_exists($key, $array)===true)
146
-				$this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array);
144
+		foreach ($this as $key => $value) {
145
+			if (array_key_exists($key, $array)===true)
146
+				$this->_callSetter("set".ucfirst($key), $key, $array[$key], $array);
147 147
 		}
148
-		foreach ( $array as $key => $value ) {
149
-			if($this->_callSetter($key, $key, $value, $array)===false){
150
-				$this->_callSetter("set" . ucfirst($key), $key, $value, $array);
148
+		foreach ($array as $key => $value) {
149
+			if ($this->_callSetter($key, $key, $value, $array)===false) {
150
+				$this->_callSetter("set".ucfirst($key), $key, $value, $array);
151 151
 			}
152 152
 		}
153 153
 		return $array;
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 	public function fromDatabaseObjects($objects, $function) {
157 157
 		if (isset($objects)) {
158
-			foreach ( $objects as $object ) {
158
+			foreach ($objects as $object) {
159 159
 				$this->fromDatabaseObject($object, $function);
160 160
 			}
161 161
 		}
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
 
178 178
 	public function getElementById($identifier, $elements) {
179
-		return $this->_getElementBy(function(BaseWidget $element) use ($identifier){return $element->getIdentifier()===$identifier;}, $elements);
179
+		return $this->_getElementBy(function(BaseWidget $element) use ($identifier){return $element->getIdentifier()===$identifier; }, $elements);
180 180
 	}
181 181
 
182 182
 	public function getBsComponent() {
@@ -189,11 +189,11 @@  discard block
 block discarded – undo
189 189
 	}
190 190
 
191 191
 	protected function compile_once(JsUtils $js=NULL, &$view=NULL) {
192
-		if(!$this->_compiled){
193
-			if(isset($js)){
192
+		if (!$this->_compiled) {
193
+			if (isset($js)) {
194 194
 				$beforeCompile=$js->getParam("beforeCompileHtml");
195
-				if(\is_callable($beforeCompile)){
196
-					$beforeCompile($this,$js,$view);
195
+				if (\is_callable($beforeCompile)) {
196
+					$beforeCompile($this, $js, $view);
197 197
 				}
198 198
 			}
199 199
 			$this->_compiled=true;
@@ -201,21 +201,21 @@  discard block
 block discarded – undo
201 201
 	}
202 202
 
203 203
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
204
-		$this->compile_once($js,$view);
204
+		$this->compile_once($js, $view);
205 205
 		$result=$this->getTemplate($js);
206
-		foreach ( $this as $key => $value ) {
207
-			if (JString::startswith($key, "_") === false && $key !== "events") {
206
+		foreach ($this as $key => $value) {
207
+			if (JString::startswith($key, "_")===false && $key!=="events") {
208 208
 				if (\is_array($value)) {
209 209
 					$v=PropertyWrapper::wrap($value, $js);
210 210
 				} else {
211 211
 					$v=$value;
212 212
 				}
213
-				$result=str_ireplace("%" . $key . "%", $v, $result);
213
+				$result=str_ireplace("%".$key."%", $v, $result);
214 214
 			}
215 215
 		}
216 216
 		if (isset($js)===true) {
217 217
 			$this->run($js);
218
-			if (isset($view) === true) {
218
+			if (isset($view)===true) {
219 219
 				$js->addViewElement($this->_identifier, $result, $view);
220 220
 			}
221 221
 		}
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/FieldAsTrait.php 1 patch
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -29,23 +29,23 @@  discard block
 block discarded – undo
29 29
  * @property boolean $_edition
30 30
  * @property mixed _modelInstance
31 31
  */
32
-trait FieldAsTrait{
32
+trait FieldAsTrait {
33 33
 
34
-	abstract protected function _getFieldIdentifier($prefix,$name="");
35
-	abstract public function setValueFunction($index,$callback);
34
+	abstract protected function _getFieldIdentifier($prefix, $name="");
35
+	abstract public function setValueFunction($index, $callback);
36 36
 	abstract protected function _getFieldName($index);
37 37
 	abstract protected function _getFieldCaption($index);
38
-	abstract protected function _buttonAsSubmit(BaseHtml &$button,$event,$url,$responseElement=NULL,$parameters=NULL);
38
+	abstract protected function _buttonAsSubmit(BaseHtml&$button, $event, $url, $responseElement=NULL, $parameters=NULL);
39 39
 
40 40
 	/**
41 41
 	 * @param HtmlFormField $element
42 42
 	 * @param array $attributes
43 43
 	 */
44
-	protected function _applyAttributes(BaseHtml $element,&$attributes,$index){
45
-		if(isset($attributes["jsCallback"])){
44
+	protected function _applyAttributes(BaseHtml $element, &$attributes, $index) {
45
+		if (isset($attributes["jsCallback"])) {
46 46
 			$callback=$attributes["jsCallback"];
47
-			if(\is_callable($callback)){
48
-				$callback($element,$this->_modelInstance,$index);
47
+			if (\is_callable($callback)) {
48
+				$callback($element, $this->_modelInstance, $index);
49 49
 				unset($attributes["jsCallback"]);
50 50
 			}
51 51
 		}
@@ -55,43 +55,43 @@  discard block
 block discarded – undo
55 55
 		$element->fromArray($attributes);
56 56
 	}
57 57
 
58
-	private function _getLabelField($caption,$icon=NULL){
59
-		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"),$caption,$icon);
58
+	private function _getLabelField($caption, $icon=NULL) {
59
+		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon);
60 60
 		return $label;
61 61
 	}
62 62
 
63 63
 
64
-	protected function _addRules(HtmlFormField $element,&$attributes){
65
-		if(isset($attributes["rules"])){
64
+	protected function _addRules(HtmlFormField $element, &$attributes) {
65
+		if (isset($attributes["rules"])) {
66 66
 			$rules=$attributes["rules"];
67
-			if(\is_array($rules)){
67
+			if (\is_array($rules)) {
68 68
 				$element->addRules($rules);
69 69
 			}
70
-			else{
70
+			else {
71 71
 				$element->addRule($rules);
72 72
 			}
73 73
 			unset($attributes["rules"]);
74 74
 		}
75 75
 	}
76 76
 
77
-	protected function _prepareFormFields(HtmlFormField &$field,$name,&$attributes){
77
+	protected function _prepareFormFields(HtmlFormField&$field, $name, &$attributes) {
78 78
 		$field->setName($name);
79 79
 		$this->_addRules($field, $attributes);
80 80
 		return $field;
81 81
 	}
82 82
 
83
-	protected function _fieldAs($elementCallback,&$index,$attributes=NULL,$prefix=null){
84
-		$this->setValueFunction($index,function($value,$instance,$index) use (&$attributes,$elementCallback,$prefix){
83
+	protected function _fieldAs($elementCallback, &$index, $attributes=NULL, $prefix=null) {
84
+		$this->setValueFunction($index, function($value, $instance, $index) use (&$attributes, $elementCallback, $prefix){
85 85
 			$caption=$this->_getFieldCaption($index);
86 86
 			$name=$this->_getFieldName($index);
87
-			$id=$this->_getFieldIdentifier($prefix,$name);
88
-			if(isset($attributes["name"])){
87
+			$id=$this->_getFieldIdentifier($prefix, $name);
88
+			if (isset($attributes["name"])) {
89 89
 				$name=$attributes["name"];
90 90
 				unset($attributes["name"]);
91 91
 			}
92
-			$element=$elementCallback($id,$name,$value,$caption);
93
-			if(\is_array($attributes)){
94
-				$this->_applyAttributes($element, $attributes,$index);
92
+			$element=$elementCallback($id, $name, $value, $caption);
93
+			if (\is_array($attributes)) {
94
+				$this->_applyAttributes($element, $attributes, $index);
95 95
 			}
96 96
 			$element->setDisabled(!$this->_edition);
97 97
 			return $element;
@@ -100,178 +100,178 @@  discard block
 block discarded – undo
100 100
 	}
101 101
 
102 102
 
103
-	public function fieldAsProgress($index,$label=NULL, $attributes=array()){
104
-		$this->setValueFunction($index,function($value) use($label,$attributes){
105
-			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"),$value,$label,$attributes);
103
+	public function fieldAsProgress($index, $label=NULL, $attributes=array()) {
104
+		$this->setValueFunction($index, function($value) use($label, $attributes){
105
+			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"), $value, $label, $attributes);
106 106
 			return $pb;
107 107
 		});
108 108
 			return $this;
109 109
 	}
110 110
 
111
-	public function fieldAsRating($index,$max=5, $icon=""){
112
-		$this->setValueFunction($index,function($value) use($max,$icon){
113
-			$rating=new HtmlRating($this->_getFieldIdentifier("rat"),$value,$max,$icon);
111
+	public function fieldAsRating($index, $max=5, $icon="") {
112
+		$this->setValueFunction($index, function($value) use($max, $icon){
113
+			$rating=new HtmlRating($this->_getFieldIdentifier("rat"), $value, $max, $icon);
114 114
 			return $rating;
115 115
 		});
116 116
 			return $this;
117 117
 	}
118 118
 
119
-	public function fieldAsLabel($index,$icon=NULL,$attributes=NULL){
120
-		return $this->_fieldAs(function($id,$name,$value) use($icon){
121
-			$lbl=new HtmlLabel($id,$value);
122
-			if(isset($icon))
119
+	public function fieldAsLabel($index, $icon=NULL, $attributes=NULL) {
120
+		return $this->_fieldAs(function($id, $name, $value) use($icon){
121
+			$lbl=new HtmlLabel($id, $value);
122
+			if (isset($icon))
123 123
 				$lbl->addIcon($icon);
124 124
 				return $lbl;
125
-		}, $index,$attributes,"label");
125
+		}, $index, $attributes, "label");
126 126
 	}
127 127
 
128
-	public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){
129
-		return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){
130
-			$header=new HtmlHeader($id,$niveau,$value);
131
-			if(isset($icon))
128
+	public function fieldAsHeader($index, $niveau=1, $icon=NULL, $attributes=NULL) {
129
+		return $this->_fieldAs(function($id, $name, $value) use($niveau, $icon){
130
+			$header=new HtmlHeader($id, $niveau, $value);
131
+			if (isset($icon))
132 132
 				$header->asIcon($icon, $value);
133 133
 			return $header;
134
-		}, $index,$attributes,"header");
134
+		}, $index, $attributes, "header");
135 135
 	}
136 136
 
137 137
 
138
-	public function fieldAsImage($index,$size=Size::MINI,$circular=false){
139
-		$this->setValueFunction($index,function($img) use($size,$circular){
140
-			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular();
138
+	public function fieldAsImage($index, $size=Size::MINI, $circular=false) {
139
+		$this->setValueFunction($index, function($img) use($size, $circular){
140
+			$image=new HtmlImage($this->_getFieldIdentifier("image"), $img); $image->setSize($size); if ($circular)$image->setCircular();
141 141
 			return $image;
142 142
 		});
143 143
 			return $this;
144 144
 	}
145 145
 
146
-	public function fieldAsFlag($index){
147
-		$this->setValueFunction($index,function($flag){
148
-			$flag=new HtmlFlag($this->_getFieldIdentifier("flag"),$flag);
146
+	public function fieldAsFlag($index) {
147
+		$this->setValueFunction($index, function($flag) {
148
+			$flag=new HtmlFlag($this->_getFieldIdentifier("flag"), $flag);
149 149
 			return $flag;
150 150
 		});
151 151
 			return $this;
152 152
 	}
153 153
 
154
-	public function fieldAsAvatar($index,$attributes=NULL){
155
-		return $this->_fieldAs(function($id,$name,$value){
156
-			$img=new HtmlImage($id,$value);
154
+	public function fieldAsAvatar($index, $attributes=NULL) {
155
+		return $this->_fieldAs(function($id, $name, $value) {
156
+			$img=new HtmlImage($id, $value);
157 157
 			$img->asAvatar();
158 158
 			return $img;
159
-		}, $index,$attributes,"avatar");
159
+		}, $index, $attributes, "avatar");
160 160
 	}
161 161
 
162
-	public function fieldAsRadio($index,$attributes=NULL){
163
-		return $this->_fieldAs(function($id,$name,$value) use($attributes){
164
-			$input= new HtmlFormRadio($id,$name,$value,$value);
162
+	public function fieldAsRadio($index, $attributes=NULL) {
163
+		return $this->_fieldAs(function($id, $name, $value) use($attributes){
164
+			$input=new HtmlFormRadio($id, $name, $value, $value);
165 165
 			return $this->_prepareFormFields($input, $name, $attributes);
166
-		}, $index,$attributes,"radio");
166
+		}, $index, $attributes, "radio");
167 167
 	}
168 168
 
169
-	public function fieldAsRadios($index,$elements=[],$attributes=NULL){
170
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($elements){
171
-			return HtmlFormFields::radios($name,$elements,$caption,$value);
172
-		}, $index,$attributes,"radios");
169
+	public function fieldAsRadios($index, $elements=[], $attributes=NULL) {
170
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($elements){
171
+			return HtmlFormFields::radios($name, $elements, $caption, $value);
172
+		}, $index, $attributes, "radios");
173 173
 	}
174 174
 
175
-	public function fieldAsInput($index,$attributes=NULL){
176
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes){
177
-			$input= new HtmlFormInput($id,$caption,"text",$value);
175
+	public function fieldAsInput($index, $attributes=NULL) {
176
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes){
177
+			$input=new HtmlFormInput($id, $caption, "text", $value);
178 178
 			return $this->_prepareFormFields($input, $name, $attributes);
179
-		}, $index,$attributes,"input");
179
+		}, $index, $attributes, "input");
180 180
 	}
181 181
 
182
-	public function fieldAsTextarea($index,$attributes=NULL){
183
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes){
184
-			$textarea=new HtmlFormTextarea($id,$caption,$value);
182
+	public function fieldAsTextarea($index, $attributes=NULL) {
183
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes){
184
+			$textarea=new HtmlFormTextarea($id, $caption, $value);
185 185
 			return $this->_prepareFormFields($textarea, $name, $attributes);
186
-		}, $index,$attributes,"textarea");
186
+		}, $index, $attributes, "textarea");
187 187
 	}
188 188
 
189
-	public function fieldAsHidden($index,$attributes=NULL){
190
-		if(!\is_array($attributes)){
189
+	public function fieldAsHidden($index, $attributes=NULL) {
190
+		if (!\is_array($attributes)) {
191 191
 			$attributes=[];
192 192
 		}
193 193
 		$attributes["inputType"]="hidden";
194
-		return $this->fieldAsInput($index,$attributes);
194
+		return $this->fieldAsInput($index, $attributes);
195 195
 	}
196 196
 
197
-	public function fieldAsCheckbox($index,$attributes=NULL){
198
-		return $this->_fieldAs(function($id,$name,$value,$caption) use($attributes){
199
-			if($caption===null || $caption==="")
197
+	public function fieldAsCheckbox($index, $attributes=NULL) {
198
+		return $this->_fieldAs(function($id, $name, $value, $caption) use($attributes){
199
+			if ($caption===null || $caption==="")
200 200
 				$caption="";
201
-			$input=new HtmlFormCheckbox($id,$caption,$this->_instanceViewer->getIdentifier());
201
+			$input=new HtmlFormCheckbox($id, $caption, $this->_instanceViewer->getIdentifier());
202 202
 			$input->setChecked(JString::isBooleanTrue($value));
203 203
 			return $this->_prepareFormFields($input, $name, $attributes);
204
-		}, $index,$attributes,"ck");
204
+		}, $index, $attributes, "ck");
205 205
 	}
206 206
 
207
-	public function fieldAsDropDown($index,$elements=[],$multiple=false,$attributes=NULL){
208
-		return $this->_fieldAs(function($id,$name,$value,$caption) use($elements,$multiple,$attributes){
209
-			$dd=new HtmlFormDropdown($id,$elements,$caption,$value);
210
-			$dd->asSelect($name,$multiple);
207
+	public function fieldAsDropDown($index, $elements=[], $multiple=false, $attributes=NULL) {
208
+		return $this->_fieldAs(function($id, $name, $value, $caption) use($elements, $multiple, $attributes){
209
+			$dd=new HtmlFormDropdown($id, $elements, $caption, $value);
210
+			$dd->asSelect($name, $multiple);
211 211
 			return $this->_prepareFormFields($dd, $name, $attributes);
212
-		}, $index,$attributes,"dd");
212
+		}, $index, $attributes, "dd");
213 213
 	}
214 214
 
215
-	public function fieldAsMessage($index,$attributes=NULL){
216
-		return $this->_fieldAs(function($id,$name,$value,$caption){
217
-			$mess= new HtmlMessage("message-".$id,$caption);
215
+	public function fieldAsMessage($index, $attributes=NULL) {
216
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
217
+			$mess=new HtmlMessage("message-".$id, $caption);
218 218
 			$mess->addHeader($value);
219 219
 			return $mess;
220
-		}, $index,$attributes,"message");
220
+		}, $index, $attributes, "message");
221 221
 	}
222 222
 
223
-	public function fieldAsLink($index,$attributes=NULL){
224
-		return $this->_fieldAs(function($id,$name,$value,$caption){
225
-			$lnk= new HtmlLink("message-".$id,"#",$caption);
223
+	public function fieldAsLink($index, $attributes=NULL) {
224
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
225
+			$lnk=new HtmlLink("message-".$id, "#", $caption);
226 226
 			return $lnk;
227
-		}, $index,$attributes,"link");
227
+		}, $index, $attributes, "link");
228 228
 	}
229 229
 
230 230
 	/**Change fields type
231 231
 	 * @param array $types an array or associative array $type=>$attributes
232 232
 	 */
233
-	public function fieldsAs(array $types){
233
+	public function fieldsAs(array $types) {
234 234
 		$i=0;
235
-		if(JArray::isAssociative($types)){
236
-			foreach ($types as $type=>$attributes){
237
-				if(\is_int($type))
238
-					$this->fieldAs($i++,$attributes,[]);
239
-				else{
240
-					$type=preg_replace('/\d/', '', $type );
241
-					$this->fieldAs($i++,$type,$attributes);
235
+		if (JArray::isAssociative($types)) {
236
+			foreach ($types as $type=>$attributes) {
237
+				if (\is_int($type))
238
+					$this->fieldAs($i++, $attributes, []);
239
+				else {
240
+					$type=preg_replace('/\d/', '', $type);
241
+					$this->fieldAs($i++, $type, $attributes);
242 242
 				}
243 243
 			}
244
-		}else{
245
-			foreach ($types as $type){
246
-				$this->fieldAs($i++,$type);
244
+		} else {
245
+			foreach ($types as $type) {
246
+				$this->fieldAs($i++, $type);
247 247
 			}
248 248
 		}
249 249
 	}
250 250
 
251
-	public function fieldAs($index,$type,$attributes=NULL){
251
+	public function fieldAs($index, $type, $attributes=NULL) {
252 252
 		$method="fieldAs".\ucfirst($type);
253
-		if(\method_exists($this, $method)){
254
-			if(!\is_array($attributes)){
253
+		if (\method_exists($this, $method)) {
254
+			if (!\is_array($attributes)) {
255 255
 				$attributes=[$index];
256
-			}else{
256
+			} else {
257 257
 				\array_unshift($attributes, $index);
258 258
 			}
259
-			\call_user_func_array([$this,$method], $attributes);
259
+			\call_user_func_array([$this, $method], $attributes);
260 260
 		}
261 261
 	}
262 262
 
263
-	public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){
264
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$attributes){
265
-			$button=new HtmlButton($id,$caption,$cssStyle);
266
-			$this->_buttonAsSubmit($button,"click",$url,$responseElement,@$attributes["ajax"]);
263
+	public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) {
264
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $attributes){
265
+			$button=new HtmlButton($id, $caption, $cssStyle);
266
+			$this->_buttonAsSubmit($button, "click", $url, $responseElement, @$attributes["ajax"]);
267 267
 			return $button;
268
-		}, $index,$attributes,"submit");
268
+		}, $index, $attributes, "submit");
269 269
 	}
270 270
 
271
-	public function fieldAsButton($index,$cssStyle=NULL,$attributes=NULL){
272
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($cssStyle){
273
-			$button=new HtmlButton($id,$value,$cssStyle);
271
+	public function fieldAsButton($index, $cssStyle=NULL, $attributes=NULL) {
272
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($cssStyle){
273
+			$button=new HtmlButton($id, $value, $cssStyle);
274 274
 			return $button;
275
-		}, $index,$attributes,"button");
275
+		}, $index, $attributes, "button");
276 276
 	}
277 277
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/base/traits/AttachedTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,6 +17,6 @@
 block discarded – undo
17 17
 		if (isset($toElement) && \method_exists($toElement, "setAttached")) {
18 18
 			$toElement->setAttached(true);
19 19
 		}
20
-		return $this->addToPropertyCtrl("class", $side . " attached", Side::getConstantValues("attached"));
20
+		return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached"));
21 21
 	}
22 22
 }
Please login to merge, or discard this patch.