Completed
Push — master ( ef9455...966ba4 )
by Jean-Christophe
02:39
created
Ajax/bootstrap/html/content/HtmlTabItem.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -62,15 +62,15 @@
 block discarded – undo
62 62
 	 */
63 63
 	public function setIdentifier($identifier) {
64 64
 		parent::setIdentifier($identifier);
65
-		if($this->content instanceof HtmlLink){
65
+		if ($this->content instanceof HtmlLink) {
66 66
 			$this->content->setIdentifier("link-".$identifier);
67 67
 		}
68 68
 	}
69
-	public function setActive($value=true){
70
-		$this->setProperty("class", ($value)?"active":"");
69
+	public function setActive($value=true) {
70
+		$this->setProperty("class", ($value) ? "active" : "");
71 71
 	}
72 72
 
73
-	public function disable(){
73
+	public function disable() {
74 74
 		$this->setProperty("class", "disabled");
75 75
 	}
76 76
 }
Please login to merge, or discard this patch.
Ajax/php/micro/JsUtils.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -4,34 +4,34 @@
 block discarded – undo
4 4
 
5 5
 use micro\controllers\Startup;
6 6
 use micro\utils\RequestUtils;
7
-class JsUtils extends \Ajax\JsUtils{
7
+class JsUtils extends \Ajax\JsUtils {
8 8
 
9
-	public function getUrl($url){
9
+	public function getUrl($url) {
10 10
 		return RequestUtils::getUrl($url);
11 11
 	}
12 12
 
13
-	public function addViewElement($identifier,$content,&$view){
13
+	public function addViewElement($identifier, $content, &$view) {
14 14
 		$controls=$view->getVar("q");
15
-		if (isset($controls) === false) {
16
-			$controls=array ();
15
+		if (isset($controls)===false) {
16
+			$controls=array();
17 17
 		}
18 18
 		$controls[$identifier]=$content;
19 19
 		$view->setVar("q", $controls);
20 20
 	}
21 21
 
22
-	public function createScriptVariable(&$view,$view_var, $output){
23
-		$view->setVar($view_var,$output);
22
+	public function createScriptVariable(&$view, $view_var, $output) {
23
+		$view->setVar($view_var, $output);
24 24
 	}
25 25
 
26
-	public function forward($initialController,$controller,$action,$params=array()){
27
-		return $initialController->forward($controller,$action,$params,true,true,true);
26
+	public function forward($initialController, $controller, $action, $params=array()) {
27
+		return $initialController->forward($controller, $action, $params, true, true, true);
28 28
 	}
29 29
 
30
-	public function renderContent($initialControllerInstance,$viewName, $params=NULL) {
31
-		return $initialControllerInstance->loadView($viewName,$params,true);
30
+	public function renderContent($initialControllerInstance, $viewName, $params=NULL) {
31
+		return $initialControllerInstance->loadView($viewName, $params, true);
32 32
 	}
33 33
 
34
-	public function fromDispatcher($dispatcher){
34
+	public function fromDispatcher($dispatcher) {
35 35
 		return Startup::$urlParts;
36 36
 	}
37 37
 }
Please login to merge, or discard this patch.
Ajax/php/laravel/JsUtils.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -4,24 +4,24 @@  discard block
 block discarded – undo
4 4
 
5 5
 use Illuminate\Support\Facades\App;
6 6
 
7
-class JsUtils extends \Ajax\JsUtils{
8
-	public function getUrl($url){
7
+class JsUtils extends \Ajax\JsUtils {
8
+	public function getUrl($url) {
9 9
 		return \url($url);
10 10
 	}
11
-	public function addViewElement($identifier,$content,&$view){
11
+	public function addViewElement($identifier, $content, &$view) {
12 12
 		$controls=$view->__get("q");
13
-		if (isset($controls) === false) {
14
-			$controls=array ();
13
+		if (isset($controls)===false) {
14
+			$controls=array();
15 15
 		}
16 16
 		$controls[$identifier]=$content;
17 17
 		$view->__set("q", $controls);
18 18
 	}
19 19
 
20
-	public function createScriptVariable(&$view,$view_var, $output){
21
-		$view->__set($view_var,$output);
20
+	public function createScriptVariable(&$view, $view_var, $output) {
21
+		$view->__set($view_var, $output);
22 22
 	}
23 23
 
24
-	public function forward($initialControllerInstance,$controllerName,$actionName,$params=NULL){
24
+	public function forward($initialControllerInstance, $controllerName, $actionName, $params=NULL) {
25 25
 		\ob_start();
26 26
 		App::make($controllerName)->{$actionName}($params);
27 27
 		$result=\ob_get_contents();
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
 		return $result;
30 30
 	}
31 31
 
32
-	public function renderContent($initialControllerInstance,$viewName, $params=NULL) {
33
-		return \view()->make($viewName,$params)->render();
32
+	public function renderContent($initialControllerInstance, $viewName, $params=NULL) {
33
+		return \view()->make($viewName, $params)->render();
34 34
 	}
35 35
 
36
-	public function fromDispatcher($dispatcher){
36
+	public function fromDispatcher($dispatcher) {
37 37
 		return $dispatcher->segments();
38 38
 	}
39 39
 }
Please login to merge, or discard this patch.
Ajax/service/JQueryAjaxEffect.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Ajax\service;
3 3
 class JQueryAjaxEffect {
4
-	public static function none($responseElement,$jqueryDone="html"){
4
+	public static function none($responseElement, $jqueryDone="html") {
5 5
 		return "\t$({$responseElement}).{$jqueryDone}( data );\n";
6 6
 	}
7 7
 
8
-	public static function fade($responseElement,$jqueryDone="html"){
8
+	public static function fade($responseElement, $jqueryDone="html") {
9 9
 		return "\t$({$responseElement}).hide().{$jqueryDone}( data ).fadeIn();\n";
10 10
 	}
11 11
 
12
-	public static function slide($responseElement,$jqueryDone="html"){
12
+	public static function slide($responseElement, $jqueryDone="html") {
13 13
 		return "\t$({$responseElement}).hide().{$jqueryDone}( data ).slideDown();\n";
14 14
 	}
15 15
 }
Please login to merge, or discard this patch.
Ajax/common/html/traits/NavElementTrait.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,22 +8,22 @@  discard block
 block discarded – undo
8 8
  * @property string $root
9 9
  * @property string $attr
10 10
  */
11
-trait NavElementTrait{
11
+trait NavElementTrait {
12 12
 
13 13
 	abstract public function contentAsString();
14 14
 	/**
15 15
 	 * Generate the jquery script to set the elements to the HtmlNavElement
16 16
 	 * @param JsUtils $jsUtils
17 17
 	 */
18
-	public function jsSetContent(JsUtils $jsUtils){
19
-		$jsUtils->html("#".$this->identifier,str_replace("\"","'", $this->contentAsString()),true);
18
+	public function jsSetContent(JsUtils $jsUtils) {
19
+		$jsUtils->html("#".$this->identifier, str_replace("\"", "'", $this->contentAsString()), true);
20 20
 	}
21 21
 
22 22
 	public function getRoot() {
23 23
 		return $this->root;
24 24
 	}
25 25
 	public function setRoot($root) {
26
-		$this->root = $root;
26
+		$this->root=$root;
27 27
 		return $this;
28 28
 	}
29 29
 	public function getAttr() {
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
 	 * @return HtmlNavElement
37 37
 	 */
38 38
 	public function setAttr($attr) {
39
-		$this->attr = $attr;
39
+		$this->attr=$attr;
40 40
 		return $this;
41 41
 	}
42 42
 
43 43
 	public function __call($method, $args) {
44
-		if(isset($this->$method) && is_callable($this->$method)) {
44
+		if (isset($this->$method) && is_callable($this->$method)) {
45 45
 			return call_user_func_array(
46 46
 					$this->$method,
47 47
 					$args
@@ -49,5 +49,5 @@  discard block
 block discarded – undo
49 49
 		}
50 50
 	}
51 51
 
52
-	abstract public function fromDispatcher(JsUtils $js,$dispatcher,$startIndex=0);
52
+	abstract public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0);
53 53
 }
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsActionsTrait.php 3 patches
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 trait JsUtilsActionsTrait {
12 12
 
13
-	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true);
13
+	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true);
14 14
 	/**
15 15
 	 * show or hide with effect
16 16
 	 *
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 * @param boolean $immediatly defers the execution if set to false
22 22
 	 * @return string
23 23
 	 */
24
-	protected function _showHideWithEffect($action,$element='this', $speed='', $callback='', $immediatly=false) {
24
+	protected function _showHideWithEffect($action, $element='this', $speed='', $callback='', $immediatly=false) {
25 25
 		$element=Javascript::prep_element($element);
26 26
 		$speed=$this->_validate_speed($speed);
27 27
 		if ($callback!='') {
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 	 * @return string
39 39
 	 */
40 40
 	private function _validate_speed($speed) {
41
-		if (in_array($speed, array (
42
-				'slow','normal','fast'
41
+		if (in_array($speed, array(
42
+				'slow', 'normal', 'fast'
43 43
 		))) {
44 44
 			$speed='"'.$speed.'"';
45 45
 		} elseif (preg_match("/[^0-9]/", $speed)) {
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @param string $param
57 57
 	 * @param boolean $immediatly delayed if false
58 58
 	 */
59
-	public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) {
59
+	public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) {
60 60
 		$element=Javascript::prep_element($element);
61 61
 		if (isset($param)) {
62 62
 			$param=Javascript::prep_value($param);
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 * @param boolean $immediatly delayed if false
77 77
 	 * @return string
78 78
 	 */
79
-	public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) {
79
+	public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) {
80 80
 		$to=Javascript::prep_element($to);
81 81
 		$element=Javascript::prep_element($element);
82 82
 		$str="$({$to}).{$jQueryCall}({$element});";
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @return string
94 94
 	 */
95 95
 	public function addClass($element='this', $class='', $immediatly=false) {
96
-		return $this->_genericCallValue('addClass',$element, $class, $immediatly);
96
+		return $this->_genericCallValue('addClass', $element, $class, $immediatly);
97 97
 	}
98 98
 
99 99
 	/**
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 	 * @param boolean $immediatly defers the execution if set to false
104 104
 	 * @return string
105 105
 	 */
106
-	public function after($to, $element, $immediatly=false){
107
-		return $this->_genericCallElement('after',$to, $element, $immediatly);
106
+	public function after($to, $element, $immediatly=false) {
107
+		return $this->_genericCallElement('after', $to, $element, $immediatly);
108 108
 	}
109 109
 
110 110
 	/**
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 	 * @param boolean $immediatly defers the execution if set to false
115 115
 	 * @return string
116 116
 	 */
117
-	public function before($to, $element, $immediatly=false){
118
-		return $this->_genericCallElement('before',$to, $element, $immediatly);
117
+	public function before($to, $element, $immediatly=false) {
118
+		return $this->_genericCallElement('before', $to, $element, $immediatly);
119 119
 	}
120 120
 
121 121
 	/**
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 * @param string $value
144 144
 	 * @param boolean $immediatly defers the execution if set to false
145 145
 	 */
146
-	public function val($element='this',$value='',$immediatly=false){
147
-		return $this->_genericCallValue('val',$element,$value,$immediatly);
146
+	public function val($element='this', $value='', $immediatly=false) {
147
+		return $this->_genericCallValue('val', $element, $value, $immediatly);
148 148
 	}
149 149
 
150 150
 	/**
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @param boolean $immediatly defers the execution if set to false
155 155
 	 */
156 156
 	public function html($element='this', $value='', $immediatly=false) {
157
-		return $this->_genericCallValue('html',$element, $value, $immediatly);
157
+		return $this->_genericCallValue('html', $element, $value, $immediatly);
158 158
 	}
159 159
 
160 160
 	/**
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
 		$animations="\t\t\t";
175 175
 		if (\is_array($params)) {
176
-			foreach ( $params as $param => $value ) {
176
+			foreach ($params as $param => $value) {
177 177
 				$animations.=$param.': \''.$value.'\', ';
178 178
 			}
179 179
 		}
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 * @return string
203 203
 	 */
204 204
 	public function append($to, $element, $immediatly=false) {
205
-		return $this->_genericCallElement('append',$to, $element, $immediatly);
205
+		return $this->_genericCallElement('append', $to, $element, $immediatly);
206 206
 	}
207 207
 
208 208
 	/**
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @return string
214 214
 	 */
215 215
 	public function prepend($to, $element, $immediatly=false) {
216
-		return $this->_genericCallElement('prepend',$to, $element, $immediatly);
216
+		return $this->_genericCallElement('prepend', $to, $element, $immediatly);
217 217
 	}
218 218
 
219 219
 	/**
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	 * @return string
227 227
 	 */
228 228
 	public function fadeIn($element='this', $speed='', $callback='', $immediatly=false) {
229
-		return $this->_showHideWithEffect("fadeIn",$element,$speed,$callback,$immediatly);
229
+		return $this->_showHideWithEffect("fadeIn", $element, $speed, $callback, $immediatly);
230 230
 	}
231 231
 
232 232
 	/**
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 * @return string
240 240
 	 */
241 241
 	public function fadeOut($element='this', $speed='', $callback='', $immediatly=false) {
242
-		return $this->_showHideWithEffect("fadeOut",$element,$speed,$callback,$immediatly);
242
+		return $this->_showHideWithEffect("fadeOut", $element, $speed, $callback, $immediatly);
243 243
 	}
244 244
 
245 245
 	/**
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * @return string
253 253
 	 */
254 254
 	public function slideUp($element='this', $speed='', $callback='', $immediatly=false) {
255
-		return $this->_showHideWithEffect("slideUp",$element,$speed,$callback,$immediatly);
255
+		return $this->_showHideWithEffect("slideUp", $element, $speed, $callback, $immediatly);
256 256
 	}
257 257
 
258 258
 	/**
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 * @return string
265 265
 	 */
266 266
 	public function removeClass($element='this', $class='', $immediatly=false) {
267
-		return $this->_genericCall('removeClass',$element, $class, $immediatly);
267
+		return $this->_genericCall('removeClass', $element, $class, $immediatly);
268 268
 	}
269 269
 
270 270
 	/**
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 * @return string
278 278
 	 */
279 279
 	public function slideDown($element='this', $speed='', $callback='', $immediatly=false) {
280
-		return $this->_showHideWithEffect("slideDown",$element,$speed,$callback,$immediatly);
280
+		return $this->_showHideWithEffect("slideDown", $element, $speed, $callback, $immediatly);
281 281
 	}
282 282
 
283 283
 	/**
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 	 * @return string
291 291
 	 */
292 292
 	public function slideToggle($element='this', $speed='', $callback='', $immediatly=false) {
293
-		return $this->_showHideWithEffect("slideToggle",$element,$speed,$callback,$immediatly);
293
+		return $this->_showHideWithEffect("slideToggle", $element, $speed, $callback, $immediatly);
294 294
 	}
295 295
 
296 296
 	/**
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 	 * @return string
304 304
 	 */
305 305
 	public function hide($element='this', $speed='', $callback='', $immediatly=false) {
306
-		return $this->_showHideWithEffect("hide",$element,$speed,$callback,$immediatly);
306
+		return $this->_showHideWithEffect("hide", $element, $speed, $callback, $immediatly);
307 307
 	}
308 308
 
309 309
 	/**
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	 * @return string
317 317
 	 */
318 318
 	public function toggle($element='this', $speed='', $callback='', $immediatly=false) {
319
-		return $this->_showHideWithEffect("toggle",$element,$speed,$callback,$immediatly);
319
+		return $this->_showHideWithEffect("toggle", $element, $speed, $callback, $immediatly);
320 320
 	}
321 321
 
322 322
 	/**
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	 * @return string
328 328
 	 */
329 329
 	public function toggleClass($element='this', $class='', $immediatly=false) {
330
-		return $this->_genericCallValue('toggleClass',$element, $class, $immediatly);
330
+		return $this->_genericCallValue('toggleClass', $element, $class, $immediatly);
331 331
 	}
332 332
 
333 333
 	/**
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 	 * @return string
356 356
 	 */
357 357
 	public function show($element='this', $speed='', $callback='', $immediatly=false) {
358
-		return $this->_showHideWithEffect("show",$element,$speed,$callback,$immediatly);
358
+		return $this->_showHideWithEffect("show", $element, $speed, $callback, $immediatly);
359 359
 	}
360 360
 
361 361
 	/**
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
 	 */
368 368
 	public function sortable($element, $options=array()) {
369 369
 		if (count($options)>0) {
370
-			$sort_options=array ();
371
-			foreach ( $options as $k => $v ) {
370
+			$sort_options=array();
371
+			foreach ($options as $k => $v) {
372 372
 				$sort_options[]="\n\t\t".$k.': '.$v."";
373 373
 			}
374 374
 			$sort_options=implode(",", $sort_options);
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
 	 * @param boolean $immediatly
466 466
 	 * @return string
467 467
 	 */
468
-	private function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="",$immediatly=true) {
469
-		return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation,$immediatly);
468
+	private function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="", $immediatly=true) {
469
+		return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation, $immediatly);
470 470
 	}
471 471
 
472 472
 	/**
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 		$preventDefault=false;
485 485
 		$immediatly=true;
486 486
 		extract($parameters);
487
-		return $this->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback,$immediatly);
487
+		return $this->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback, $immediatly);
488 488
 	}
489 489
 
490 490
 	/**
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 		$preventDefault=false;
514 514
 		$immediatly=true;
515 515
 		extract($parameters);
516
-		$script=$this->_add_event($element, $this->exec($js), $event, $preventDefault, $stopPropagation,$immediatly);
516
+		$script=$this->_add_event($element, $this->exec($js), $event, $preventDefault, $stopPropagation, $immediatly);
517 517
 		return $script;
518 518
 	}
519 519
 }
Please login to merge, or discard this patch.
Braces   +36 added lines, -24 removed lines patch added patch discarded remove patch
@@ -28,8 +28,9 @@  discard block
 block discarded – undo
28 28
 			$callback=", function(){\n{$callback}\n}";
29 29
 		}
30 30
 		$str="$({$element}).{$action}({$speed}{$callback});";
31
-		if ($immediatly)
32
-			$this->jquery_code_for_compile[]=$str;
31
+		if ($immediatly) {
32
+					$this->jquery_code_for_compile[]=$str;
33
+		}
33 34
 			return $str;
34 35
 	}
35 36
 	/**
@@ -61,10 +62,12 @@  discard block
 block discarded – undo
61 62
 		if (isset($param)) {
62 63
 			$param=Javascript::prep_value($param);
63 64
 			$str="$({$element}).{$jQueryCall}({$param});";
64
-		} else
65
-			$str="$({$element}).{$jQueryCall}();";
66
-		if ($immediatly)
67
-			$this->jquery_code_for_compile[]=$str;
65
+		} else {
66
+					$str="$({$element}).{$jQueryCall}();";
67
+		}
68
+		if ($immediatly) {
69
+					$this->jquery_code_for_compile[]=$str;
70
+		}
68 71
 		return $str;
69 72
 	}
70 73
 
@@ -80,8 +83,9 @@  discard block
 block discarded – undo
80 83
 		$to=Javascript::prep_element($to);
81 84
 		$element=Javascript::prep_element($element);
82 85
 		$str="$({$to}).{$jQueryCall}({$element});";
83
-		if ($immediatly)
84
-			$this->jquery_code_for_compile[]=$str;
86
+		if ($immediatly) {
87
+					$this->jquery_code_for_compile[]=$str;
88
+		}
85 89
 		return $str;
86 90
 	}
87 91
 	/**
@@ -130,10 +134,12 @@  discard block
 block discarded – undo
130 134
 		if (isset($value)) {
131 135
 			$value=Javascript::prep_value($value);
132 136
 			$str="$({$element}).attr(\"$attributeName\",{$value});";
133
-		} else
134
-			$str="$({$element}).attr(\"$attributeName\");";
135
-		if ($immediatly)
136
-			$this->jquery_code_for_compile[]=$str;
137
+		} else {
138
+					$str="$({$element}).attr(\"$attributeName\");";
139
+		}
140
+		if ($immediatly) {
141
+					$this->jquery_code_for_compile[]=$str;
142
+		}
137 143
 		return $str;
138 144
 	}
139 145
 
@@ -189,8 +195,9 @@  discard block
 block discarded – undo
189 195
 
190 196
 		$str="$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");";
191 197
 
192
-		if ($immediatly)
193
-			$this->jquery_code_for_compile[]=$str;
198
+		if ($immediatly) {
199
+					$this->jquery_code_for_compile[]=$str;
200
+		}
194 201
 		return $str;
195 202
 	}
196 203
 
@@ -340,8 +347,9 @@  discard block
 block discarded – undo
340 347
 		$element=Javascript::prep_element($element);
341 348
 		$str="$({$element}).trigger(\"$event\");";
342 349
 
343
-		if ($immediatly)
344
-			$this->jquery_code_for_compile[]=$str;
350
+		if ($immediatly) {
351
+					$this->jquery_code_for_compile[]=$str;
352
+		}
345 353
 		return $str;
346 354
 	}
347 355
 
@@ -403,8 +411,9 @@  discard block
 block discarded – undo
403 411
 			$str.="else{".$jsCodeIfFalse."}";
404 412
 		}
405 413
 
406
-		if ($immediatly)
407
-			$this->jquery_code_for_compile[]=$str;
414
+		if ($immediatly) {
415
+					$this->jquery_code_for_compile[]=$str;
416
+		}
408 417
 		return $str;
409 418
 	}
410 419
 
@@ -420,11 +429,13 @@  discard block
 block discarded – undo
420 429
 	private function _doJQuery($element, $jqueryCall, $param="", $jsCallback="", $immediatly=false) {
421 430
 		$param=Javascript::prep_value($param);
422 431
 		$callback="";
423
-		if ($jsCallback!="")
424
-			$callback=", function(event){\n{$jsCallback}\n}";
432
+		if ($jsCallback!="") {
433
+					$callback=", function(event){\n{$jsCallback}\n}";
434
+		}
425 435
 			$script="$(".Javascript::prep_element($element).").".$jqueryCall."(".$param.$callback.");\n";
426
-			if ($immediatly)
427
-				$this->jquery_code_for_compile[]=$script;
436
+			if ($immediatly) {
437
+							$this->jquery_code_for_compile[]=$script;
438
+			}
428 439
 				return $script;
429 440
 	}
430 441
 
@@ -495,8 +506,9 @@  discard block
 block discarded – undo
495 506
 	 */
496 507
 	public function exec($js, $immediatly=false) {
497 508
 		$script=$js."\n";
498
-		if ($immediatly)
499
-			$this->jquery_code_for_compile[]=$script;
509
+		if ($immediatly) {
510
+					$this->jquery_code_for_compile[]=$script;
511
+		}
500 512
 		return $script;
501 513
 	}
502 514
 
Please login to merge, or discard this patch.
Doc Comments   +10 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,6 +11,11 @@  discard block
 block discarded – undo
11 11
  */
12 12
 trait JsUtilsActionsTrait {
13 13
 
14
+	/**
15
+	 * @param string $element
16
+	 * @param string $js
17
+	 * @param string $event
18
+	 */
14 19
 	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true);
15 20
 	/**
16 21
 	 * show or hide with effect
@@ -35,7 +40,7 @@  discard block
 block discarded – undo
35 40
 	}
36 41
 	/**
37 42
 	 * Ensures the speed parameter is valid for jQuery
38
-	 * @param string|int $speed
43
+	 * @param string $speed
39 44
 	 * @return string
40 45
 	 */
41 46
 	private function _validate_speed($speed) {
@@ -364,7 +369,7 @@  discard block
 block discarded – undo
364 369
 	 *
365 370
 	 * @param string $element
366 371
 	 * @param array $options
367
-	 * @return void
372
+	 * @return string
368 373
 	 */
369 374
 	public function sortable($element, $options=array()) {
370 375
 		if (count($options)>0) {
@@ -435,7 +440,7 @@  discard block
 block discarded – undo
435 440
 	 * @param string $jqueryCall the JQuery callback
436 441
 	 * @param mixed $param array or string parameters
437 442
 	 * @param string $jsCallback javascript code to execute after the jquery call
438
-	 * @return mixed
443
+	 * @return string
439 444
 	 */
440 445
 	public function doJQuery($element, $jqueryCall, $param="", $jsCallback="") {
441 446
 		return $this->_doJQuery($element, $jqueryCall, $param, $jsCallback, true);
@@ -447,7 +452,7 @@  discard block
 block discarded – undo
447 452
 	 * @param string $jqueryCall the JQuery callback
448 453
 	 * @param mixed $param array or string parameters
449 454
 	 * @param string $jsCallback javascript code to execute after the jquery call
450
-	 * @return mixed
455
+	 * @return string
451 456
 	 */
452 457
 	public function doJQueryDeferred($element, $jqueryCall, $param="", $jsCallback="") {
453 458
 		return $this->_doJQuery($element, $jqueryCall, $param, $jsCallback, false);
@@ -459,7 +464,7 @@  discard block
 block discarded – undo
459 464
 	 * @param string $element
460 465
 	 * @param string $elementToModify
461 466
 	 * @param string $jqueryCall
462
-	 * @param string|array $param
467
+	 * @param string $param
463 468
 	 * @param boolean $preventDefault
464 469
 	 * @param boolean $stopPropagation
465 470
 	 * @param string $jsCallback javascript code to execute after the jquery call
@@ -504,7 +509,6 @@  discard block
 block discarded – undo
504 509
 	/**
505 510
 	 * Executes the code $js
506 511
 	 * @param string $js Code to execute
507
-	 * @param boolean $immediatly delayed if false
508 512
 	 * @return String
509 513
 	 */
510 514
 	public function execAtLast($js) {
Please login to merge, or discard this patch.
Ajax/common/components/SimpleComponent.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -18,27 +18,27 @@  discard block
 block discarded – undo
18 18
 
19 19
 	public function __construct(JsUtils $js=NULL) {
20 20
 		parent::__construct($js);
21
-		$this->events=array ();
21
+		$this->events=array();
22 22
 	}
23 23
 
24 24
 	protected function compileEvents() {
25
-		foreach ( $this->events as $event => $jsCode ) {
25
+		foreach ($this->events as $event => $jsCode) {
26 26
 			$itemSelector=JString::getValueBetween($event);
27
-			if($event=="execute"){
27
+			if ($event=="execute") {
28 28
 				$this->jquery_code_for_compile []=$jsCode;
29
-			}else if($event=="beforeExecute"){
29
+			} else if ($event=="beforeExecute") {
30 30
 				\array_unshift($this->jquery_code_for_compile, $jsCode);
31
-			}else{
31
+			} else {
32 32
 				$selector=$this->_createSelector($itemSelector, $this->attachTo);
33 33
 				$this->jquery_code_for_compile []="$( \"".$selector."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});";
34 34
 			}
35 35
 		}
36 36
 	}
37 37
 
38
-	protected function _createSelector($itemSelector,$selector){
39
-		if(!isset($itemSelector))
38
+	protected function _createSelector($itemSelector, $selector) {
39
+		if (!isset($itemSelector))
40 40
 			$itemSelector=$this->itemSelector;
41
-		if(isset($itemSelector) && $itemSelector!=="")
41
+		if (isset($itemSelector) && $itemSelector!=="")
42 42
 			$selector.=" ".$itemSelector;
43 43
 		return $selector;
44 44
 	}
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		$result=implode("\n", $this->jquery_code_for_compile);
48 48
 		$result=str_ireplace("\"%", "", $result);
49 49
 		$result=str_ireplace("%\"", "", $result);
50
-		$result=str_replace(array (
50
+		$result=str_replace(array(
51 51
 				"\\n",
52 52
 				"\\r",
53 53
 				"\\t"
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
 	public function getScript() {
59 59
 		$allParams=$this->params;
60
-		$this->jquery_code_for_compile=array ();
60
+		$this->jquery_code_for_compile=array();
61 61
 		$this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).{$this->uiName}(".$this->getParamsAsJSON($allParams).");";
62 62
 		$this->compileEvents();
63 63
 		return $this->compileJQueryCode();
Please login to merge, or discard this patch.
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
 			$itemSelector=JString::getValueBetween($event);
27 27
 			if($event=="execute"){
28 28
 				$this->jquery_code_for_compile []=$jsCode;
29
-			}else if($event=="beforeExecute"){
29
+			} else if($event=="beforeExecute"){
30 30
 				\array_unshift($this->jquery_code_for_compile, $jsCode);
31
-			}else{
31
+			} else{
32 32
 				$selector=$this->_createSelector($itemSelector, $this->attachTo);
33 33
 				$this->jquery_code_for_compile []="$( \"".$selector."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});";
34 34
 			}
@@ -36,10 +36,12 @@  discard block
 block discarded – undo
36 36
 	}
37 37
 
38 38
 	protected function _createSelector($itemSelector,$selector){
39
-		if(!isset($itemSelector))
40
-			$itemSelector=$this->itemSelector;
41
-		if(isset($itemSelector) && $itemSelector!=="")
42
-			$selector.=" ".$itemSelector;
39
+		if(!isset($itemSelector)) {
40
+					$itemSelector=$this->itemSelector;
41
+		}
42
+		if(isset($itemSelector) && $itemSelector!=="") {
43
+					$selector.=" ".$itemSelector;
44
+		}
43 45
 		return $selector;
44 46
 	}
45 47
 
@@ -82,8 +84,9 @@  discard block
 block discarded – undo
82 84
 
83 85
 	protected function setParamCtrl($key, $value, $typeCtrl) {
84 86
 		if (\is_array($typeCtrl)) {
85
-			if (array_search($value, $typeCtrl)===false)
86
-				throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
87
+			if (array_search($value, $typeCtrl)===false) {
88
+							throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
89
+			}
87 90
 		} else {
88 91
 			if (!$typeCtrl($value)) {
89 92
 				throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." au composant ".$this->uiName);
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/InstanceViewer.php 3 patches
Braces   +42 added lines, -36 removed lines patch added patch discarded remove patch
@@ -23,8 +23,9 @@  discard block
 block discarded – undo
23 23
 		$this->widgetIdentifier=$identifier;
24 24
 		$this->values=[];
25 25
 		$this->afterCompile=[];
26
-		if(isset($instance))
27
-			$this->setInstance($instance);
26
+		if(isset($instance)) {
27
+					$this->setInstance($instance);
28
+		}
28 29
 		$this->setCaptions($captions);
29 30
 		$this->captionCallback=NULL;
30 31
 		$this->defaultValueFunction=function($name,$value){return $value;};
@@ -62,14 +63,16 @@  discard block
 block discarded – undo
62 63
 	}
63 64
 
64 65
 	public function getIdentifier($index=NULL){
65
-		if(!isset($index))
66
-			$index=self::$index;
66
+		if(!isset($index)) {
67
+					$index=self::$index;
68
+		}
67 69
 		$value=$index;
68 70
 		if(isset($this->values["identifier"])){
69
-			if(\is_string($this->values["identifier"]))
70
-				$value=JReflection::callMethod($this->instance, $this->values["identifier"], []);
71
-			else
72
-				$value=$this->values["identifier"]($index,$this->instance);
71
+			if(\is_string($this->values["identifier"])) {
72
+							$value=JReflection::callMethod($this->instance, $this->values["identifier"], []);
73
+			} else {
74
+							$value=$this->values["identifier"]($index,$this->instance);
75
+			}
73 76
 		}
74 77
 		return $value;
75 78
 	}
@@ -99,16 +102,16 @@  discard block
 block discarded – undo
99 102
 		if($property instanceof \ReflectionProperty){
100 103
 			$value=$this->_getPropertyValue($property, $index);
101 104
 			$propertyName=$property->getName();
102
-		}elseif(\is_callable($property))
103
-			$value=$property($this->instance);
104
-		elseif(\is_array($property)){
105
+		} elseif(\is_callable($property)) {
106
+					$value=$property($this->instance);
107
+		} elseif(\is_array($property)){
105 108
 			$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property);
106 109
 			$value=\implode("", $values);
107
-		}elseif(\is_string($property)){
110
+		} elseif(\is_string($property)){
108 111
 			$value=$property;
109 112
 			if(isset($this->instance->{$property})){
110 113
 				$value=$this->instance->{$property};
111
-			}elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){
114
+			} elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){
112 115
 				$value=JReflection::callMethod($this->instance, $getter, []);
113 116
 			}
114 117
 		}
@@ -118,7 +121,7 @@  discard block
 block discarded – undo
118 121
 	protected function _postGetValue($index,$propertyName,$value){
119 122
 		if(isset($this->values[$index])){
120 123
 			$value= $this->values[$index]($value,$this->instance,$index);
121
-		}else{
124
+		} else{
122 125
 			$value=$this->_getDefaultValue($propertyName,$value, $index);
123 126
 		}
124 127
 		if(isset($this->afterCompile[$index])){
@@ -139,10 +142,10 @@  discard block
 block discarded – undo
139 142
 		if(isset($vb[$index])){
140 143
 			if(\is_array($vb[$index])){
141 144
 				$this->visibleProperties[$index][]=$field;
142
-			}else{
145
+			} else{
143 146
 				$this->visibleProperties[$index]=[$vb[$index],$field];
144 147
 			}
145
-		}else{
148
+		} else{
146 149
 			return $this->insertField($index, $field);
147 150
 		}
148 151
 		return $this;
@@ -169,9 +172,9 @@  discard block
 block discarded – undo
169 172
 		$property=$this->getProperty($index);
170 173
 		if($property instanceof \ReflectionProperty){
171 174
 			$result=$property->getName();
172
-		}elseif(\is_callable($property)){
175
+		} elseif(\is_callable($property)){
173 176
 			$result=$this->visibleProperties[$index];
174
-		}else{
177
+		} else{
175 178
 			$result=$property;
176 179
 		}
177 180
 		return $result;
@@ -191,7 +194,7 @@  discard block
 block discarded – undo
191 194
 		$this->reflect=new \ReflectionClass($instance);
192 195
 		if(\sizeof($this->visibleProperties)===0){
193 196
 			$this->properties=$this->getDefaultProperties();
194
-		}else{
197
+		} else{
195 198
 			foreach ($this->visibleProperties as $property){
196 199
 				$this->setInstanceProperty($property);
197 200
 			}
@@ -202,22 +205,23 @@  discard block
 block discarded – undo
202 205
 	private function setInstanceProperty($property){
203 206
 		if(\is_callable($property)){
204 207
 			$this->properties[]=$property;
205
-		}elseif(\is_string($property)){
208
+		} elseif(\is_string($property)){
206 209
 			try{
207 210
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
208 211
 				$rProperty=$this->reflect->getProperty($property);
209 212
 				$this->properties[]=$rProperty;
210
-			}catch(\Exception $e){
213
+			} catch(\Exception $e){
211 214
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
212 215
 				$this->properties[]=$property;
213 216
 			}
214
-		}elseif(\is_int($property)){
217
+		} elseif(\is_int($property)){
215 218
 			$props=$this->getDefaultProperties();
216
-			if(isset($props[$property]))
217
-				$this->properties[]=$props[$property];
218
-				else
219
-					$this->properties[]=$property;
220
-		}else{
219
+			if(isset($props[$property])) {
220
+							$this->properties[]=$props[$property];
221
+			} else {
222
+									$this->properties[]=$property;
223
+				}
224
+		} else{
221 225
 			$this->properties[]=$property;
222 226
 		}
223 227
 	}
@@ -261,12 +265,13 @@  discard block
 block discarded – undo
261 265
 		if(isset($this->captions[$index])){
262 266
 			return $this->captions[$index];
263 267
 		}
264
-		if($this->properties[$index] instanceof \ReflectionProperty)
265
-			return $this->properties[$index]->getName();
266
-		elseif(\is_callable($this->properties[$index]))
267
-			return "";
268
-		else
269
-			return $this->properties[$index];
268
+		if($this->properties[$index] instanceof \ReflectionProperty) {
269
+					return $this->properties[$index]->getName();
270
+		} elseif(\is_callable($this->properties[$index])) {
271
+					return "";
272
+		} else {
273
+					return $this->properties[$index];
274
+		}
270 275
 	}
271 276
 
272 277
 	public function getCaptions(){
@@ -277,7 +282,7 @@  discard block
 block discarded – undo
277 282
 			for($i=$captionsSize;$i<$count;$i++){
278 283
 				$captions[]="";
279 284
 			}
280
-		}else{
285
+		} else{
281 286
 			$captions=[];
282 287
 			$index=0;
283 288
 			while($index<$count){
@@ -292,8 +297,9 @@  discard block
 block discarded – undo
292 297
 	}
293 298
 
294 299
 	public function setCaption($index,$caption){
295
-		if(isset($this->captions)===false)
296
-			$this->captions=[];
300
+		if(isset($this->captions)===false) {
301
+					$this->captions=[];
302
+		}
297 303
 		$this->captions[$index]=$caption;
298 304
 		return $this;
299 305
 	}
Please login to merge, or discard this patch.
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -19,220 +19,220 @@  discard block
 block discarded – undo
19 19
 
20 20
 	public static $index=0;
21 21
 
22
-	public function __construct($identifier,$instance=NULL,$captions=NULL){
22
+	public function __construct($identifier, $instance=NULL, $captions=NULL) {
23 23
 		$this->widgetIdentifier=$identifier;
24 24
 		$this->values=[];
25 25
 		$this->afterCompile=[];
26
-		if(isset($instance))
26
+		if (isset($instance))
27 27
 			$this->setInstance($instance);
28 28
 		$this->setCaptions($captions);
29 29
 		$this->captionCallback=NULL;
30
-		$this->defaultValueFunction=function($name,$value){return $value;};
30
+		$this->defaultValueFunction=function($name, $value) {return $value; };
31 31
 	}
32 32
 
33
-	public function moveFieldTo($from,$to){
34
-		if(JArray::moveElementTo($this->visibleProperties, $from, $to)){
33
+	public function moveFieldTo($from, $to) {
34
+		if (JArray::moveElementTo($this->visibleProperties, $from, $to)) {
35 35
 			return JArray::moveElementTo($this->values, $from, $to);
36 36
 		}
37 37
 		return false;
38 38
 	}
39 39
 
40
-	public function swapFields($index1,$index2){
41
-		if(JArray::swapElements($this->visibleProperties, $index1, $index2)){
40
+	public function swapFields($index1, $index2) {
41
+		if (JArray::swapElements($this->visibleProperties, $index1, $index2)) {
42 42
 			return JArray::swapElements($this->values, $index1, $index2);
43 43
 		}
44 44
 		return false;
45 45
 	}
46 46
 
47
-	public function removeField($index){
48
-		\array_splice($this->visibleProperties,$index,1);
49
-		\array_splice($this->values,$index,1);
50
-		\array_splice($this->captions,$index,1);
47
+	public function removeField($index) {
48
+		\array_splice($this->visibleProperties, $index, 1);
49
+		\array_splice($this->values, $index, 1);
50
+		\array_splice($this->captions, $index, 1);
51 51
 		return $this;
52 52
 	}
53 53
 
54
-	public function getValues(){
54
+	public function getValues() {
55 55
 		$values=[];
56 56
 		$index=0;
57 57
 		$count=$this->count();
58
-		while($index<$count){
58
+		while ($index<$count) {
59 59
 			$values[]=$this->getValue($index++);
60 60
 		}
61 61
 		return $values;
62 62
 	}
63 63
 
64
-	public function getIdentifier($index=NULL){
65
-		if(!isset($index))
64
+	public function getIdentifier($index=NULL) {
65
+		if (!isset($index))
66 66
 			$index=self::$index;
67 67
 		$value=$index;
68
-		if(isset($this->values["identifier"])){
69
-			if(\is_string($this->values["identifier"]))
68
+		if (isset($this->values["identifier"])) {
69
+			if (\is_string($this->values["identifier"]))
70 70
 				$value=JReflection::callMethod($this->instance, $this->values["identifier"], []);
71 71
 			else
72
-				$value=$this->values["identifier"]($index,$this->instance);
72
+				$value=$this->values["identifier"]($index, $this->instance);
73 73
 		}
74 74
 		return $value;
75 75
 	}
76 76
 
77
-	public function getValue($index){
77
+	public function getValue($index) {
78 78
 		$property=$this->properties[$index];
79 79
 		return $this->_getValue($property, $index);
80 80
 	}
81 81
 
82
-	protected function _beforeAddProperty($index,&$field){
82
+	protected function _beforeAddProperty($index, &$field) {
83 83
 
84 84
 	}
85 85
 
86
-	protected function _getDefaultValue($name,$value,$index){
86
+	protected function _getDefaultValue($name, $value, $index) {
87 87
 		$func=$this->defaultValueFunction;
88
-		return $func($name,$value,$index,$this->instance);
88
+		return $func($name, $value, $index, $this->instance);
89 89
 	}
90 90
 
91
-	protected function _getPropertyValue(\ReflectionProperty $property,$index){
91
+	protected function _getPropertyValue(\ReflectionProperty $property, $index) {
92 92
 		$property->setAccessible(true);
93 93
 		return $property->getValue($this->instance);
94 94
 	}
95 95
 
96
-	protected function _getValue($property,$index){
96
+	protected function _getValue($property, $index) {
97 97
 		$value=null;
98 98
 		$propertyName=$property;
99
-		if($property instanceof \ReflectionProperty){
99
+		if ($property instanceof \ReflectionProperty) {
100 100
 			$value=$this->_getPropertyValue($property, $index);
101 101
 			$propertyName=$property->getName();
102
-		}elseif(\is_callable($property))
102
+		}elseif (\is_callable($property))
103 103
 			$value=$property($this->instance);
104
-		elseif(\is_array($property)){
105
-			$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property);
104
+		elseif (\is_array($property)) {
105
+			$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index); }, $property);
106 106
 			$value=\implode("", $values);
107
-		}elseif(\is_string($property)){
107
+		}elseif (\is_string($property)) {
108 108
 			$value=$property;
109
-			if(isset($this->instance->{$property})){
109
+			if (isset($this->instance->{$property})) {
110 110
 				$value=$this->instance->{$property};
111
-			}elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){
111
+			}elseif (\method_exists($this->instance, $getter=JReflection::getterName($property))) {
112 112
 				$value=JReflection::callMethod($this->instance, $getter, []);
113 113
 			}
114 114
 		}
115 115
 		return $this->_postGetValue($index, $propertyName, $value);
116 116
 	}
117 117
 
118
-	protected function _postGetValue($index,$propertyName,$value){
119
-		if(isset($this->values[$index])){
120
-			$value= $this->values[$index]($value,$this->instance,$index);
121
-		}else{
122
-			$value=$this->_getDefaultValue($propertyName,$value, $index);
118
+	protected function _postGetValue($index, $propertyName, $value) {
119
+		if (isset($this->values[$index])) {
120
+			$value=$this->values[$index]($value, $this->instance, $index);
121
+		} else {
122
+			$value=$this->_getDefaultValue($propertyName, $value, $index);
123 123
 		}
124
-		if(isset($this->afterCompile[$index])){
125
-			if(\is_callable($this->afterCompile[$index])){
126
-				$this->afterCompile[$index]($value,$this->instance,$index);
124
+		if (isset($this->afterCompile[$index])) {
125
+			if (\is_callable($this->afterCompile[$index])) {
126
+				$this->afterCompile[$index]($value, $this->instance, $index);
127 127
 			}
128 128
 		}
129 129
 		return $value;
130 130
 	}
131 131
 
132
-	public function insertField($index,$field){
133
-		array_splice( $this->visibleProperties, $index, 0, $field );
132
+	public function insertField($index, $field) {
133
+		array_splice($this->visibleProperties, $index, 0, $field);
134 134
 		return $this;
135 135
 	}
136 136
 
137
-	public function insertInField($index,$field){
137
+	public function insertInField($index, $field) {
138 138
 		$vb=$this->visibleProperties;
139
-		if(isset($vb[$index])){
140
-			if(\is_array($vb[$index])){
139
+		if (isset($vb[$index])) {
140
+			if (\is_array($vb[$index])) {
141 141
 				$this->visibleProperties[$index][]=$field;
142
-			}else{
143
-				$this->visibleProperties[$index]=[$vb[$index],$field];
142
+			} else {
143
+				$this->visibleProperties[$index]=[$vb[$index], $field];
144 144
 			}
145
-		}else{
145
+		} else {
146 146
 			return $this->insertField($index, $field);
147 147
 		}
148 148
 		return $this;
149 149
 	}
150 150
 
151
-	public function addField($field){
151
+	public function addField($field) {
152 152
 		$this->visibleProperties[]=$field;
153 153
 		return $this;
154 154
 	}
155 155
 
156
-	public function addFields($fields){
157
-		$this->visibleProperties=\array_merge($this->visibleProperties,$fields);
156
+	public function addFields($fields) {
157
+		$this->visibleProperties=\array_merge($this->visibleProperties, $fields);
158 158
 		return $this;
159 159
 	}
160 160
 
161
-	public function count(){
161
+	public function count() {
162 162
 		return \sizeof($this->properties);
163 163
 	}
164 164
 
165
-	public function visiblePropertiesCount(){
165
+	public function visiblePropertiesCount() {
166 166
 		return \sizeof($this->visibleProperties);
167 167
 	}
168 168
 
169
-	public function getProperty($index){
169
+	public function getProperty($index) {
170 170
 		return $this->properties[$index];
171 171
 	}
172 172
 
173
-	public function getFieldName($index){
173
+	public function getFieldName($index) {
174 174
 		$property=$this->getProperty($index);
175
-		if($property instanceof \ReflectionProperty){
175
+		if ($property instanceof \ReflectionProperty) {
176 176
 			$result=$property->getName();
177
-		}elseif(\is_callable($property)){
177
+		}elseif (\is_callable($property)) {
178 178
 			$result=$this->visibleProperties[$index];
179
-		}else{
179
+		} else {
180 180
 			$result=$property;
181 181
 		}
182 182
 		return $result;
183 183
 	}
184 184
 
185 185
 
186
-	protected function showableProperty(\ReflectionProperty $rProperty){
187
-		return JString::startswith($rProperty->getName(),"_")===false;
186
+	protected function showableProperty(\ReflectionProperty $rProperty) {
187
+		return JString::startswith($rProperty->getName(), "_")===false;
188 188
 	}
189 189
 
190 190
 	public function setInstance($instance) {
191
-		if(\is_string($instance)){
191
+		if (\is_string($instance)) {
192 192
 			$instance=new $instance();
193 193
 		}
194 194
 		$this->instance=$instance;
195 195
 		$this->properties=[];
196 196
 		$this->reflect=new \ReflectionClass($instance);
197
-		if(\sizeof($this->visibleProperties)===0){
197
+		if (\sizeof($this->visibleProperties)===0) {
198 198
 			$this->properties=$this->getDefaultProperties();
199
-		}else{
200
-			foreach ($this->visibleProperties as $property){
199
+		} else {
200
+			foreach ($this->visibleProperties as $property) {
201 201
 				$this->setInstanceProperty($property);
202 202
 			}
203 203
 		}
204 204
 		return $this;
205 205
 	}
206 206
 
207
-	private function setInstanceProperty($property){
208
-		if(\is_callable($property)){
207
+	private function setInstanceProperty($property) {
208
+		if (\is_callable($property)) {
209 209
 			$this->properties[]=$property;
210
-		}elseif(\is_string($property)){
211
-			try{
210
+		}elseif (\is_string($property)) {
211
+			try {
212 212
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
213 213
 				$rProperty=$this->reflect->getProperty($property);
214 214
 				$this->properties[]=$rProperty;
215
-			}catch(\Exception $e){
215
+			}catch (\Exception $e) {
216 216
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
217 217
 				$this->properties[]=$property;
218 218
 			}
219
-		}elseif(\is_int($property)){
219
+		}elseif (\is_int($property)) {
220 220
 			$props=$this->getDefaultProperties();
221
-			if(isset($props[$property]))
221
+			if (isset($props[$property]))
222 222
 				$this->properties[]=$props[$property];
223 223
 				else
224 224
 					$this->properties[]=$property;
225
-		}else{
225
+		} else {
226 226
 			$this->properties[]=$property;
227 227
 		}
228 228
 	}
229 229
 
230
-	protected function getDefaultProperties(){
230
+	protected function getDefaultProperties() {
231 231
 		$result=[];
232 232
 		$properties=$this->reflect->getProperties();
233
-		foreach ($properties as $property){
233
+		foreach ($properties as $property) {
234 234
 			$showable=$this->showableProperty($property);
235
-			if($showable!==false){
235
+			if ($showable!==false) {
236 236
 				$result[]=$property;
237 237
 			}
238 238
 		}
@@ -244,12 +244,12 @@  discard block
 block discarded – undo
244 244
 		return $this;
245 245
 	}
246 246
 
247
-	public function setValueFunction($index,$callback){
247
+	public function setValueFunction($index, $callback) {
248 248
 		$this->values[$index]=$callback;
249 249
 		return $this;
250 250
 	}
251 251
 
252
-	public function setIdentifierFunction($callback){
252
+	public function setIdentifierFunction($callback) {
253 253
 		$this->values["identifier"]=$callback;
254 254
 		return $this;
255 255
 	}
@@ -262,42 +262,42 @@  discard block
 block discarded – undo
262 262
 		return $this->properties;
263 263
 	}
264 264
 
265
-	public function getCaption($index){
266
-		if(isset($this->captions[$index])){
265
+	public function getCaption($index) {
266
+		if (isset($this->captions[$index])) {
267 267
 			return $this->captions[$index];
268 268
 		}
269
-		if($this->properties[$index] instanceof \ReflectionProperty)
269
+		if ($this->properties[$index] instanceof \ReflectionProperty)
270 270
 			return $this->properties[$index]->getName();
271
-		elseif(\is_callable($this->properties[$index]))
271
+		elseif (\is_callable($this->properties[$index]))
272 272
 			return "";
273 273
 		else
274 274
 			return $this->properties[$index];
275 275
 	}
276 276
 
277
-	public function getCaptions(){
277
+	public function getCaptions() {
278 278
 		$count=$this->count();
279
-		if(isset($this->captions)){
280
-			$captions= \array_values($this->captions);
279
+		if (isset($this->captions)) {
280
+			$captions=\array_values($this->captions);
281 281
 			$captionsSize=\sizeof($captions);
282
-			for($i=$captionsSize;$i<$count;$i++){
282
+			for ($i=$captionsSize; $i<$count; $i++) {
283 283
 				$captions[]="";
284 284
 			}
285
-		}else{
285
+		} else {
286 286
 			$captions=[];
287 287
 			$index=0;
288
-			while($index<$count){
288
+			while ($index<$count) {
289 289
 				$captions[]=$this->getCaption($index++);
290 290
 			}
291 291
 		}
292
-		if(isset($this->captionCallback) && \is_callable($this->captionCallback)){
292
+		if (isset($this->captionCallback) && \is_callable($this->captionCallback)) {
293 293
 			$callback=$this->captionCallback;
294
-			$callback($captions,$this->instance);
294
+			$callback($captions, $this->instance);
295 295
 		}
296 296
 		return $captions;
297 297
 	}
298 298
 
299
-	public function setCaption($index,$caption){
300
-		if(isset($this->captions)===false)
299
+	public function setCaption($index, $caption) {
300
+		if (isset($this->captions)===false)
301 301
 			$this->captions=[];
302 302
 		$this->captions[$index]=$caption;
303 303
 		return $this;
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	 * @param callable $callback function called after the field compilation
316 316
 	 * @return \Ajax\semantic\widgets\datatable\InstanceViewer
317 317
 	 */
318
-	public function afterCompile($index,$callback){
318
+	public function afterCompile($index, $callback) {
319 319
 		$this->afterCompile[$index]=$callback;
320 320
 		return $this;
321 321
 	}
Please login to merge, or discard this patch.
Doc Comments   +7 added lines, -1 removed lines patch added patch discarded remove patch
@@ -244,6 +244,9 @@  discard block
 block discarded – undo
244 244
 		return $this;
245 245
 	}
246 246
 
247
+	/**
248
+	 * @param callable $callback
249
+	 */
247 250
 	public function setValueFunction($index,$callback){
248 251
 		$this->values[$index]=$callback;
249 252
 		return $this;
@@ -254,6 +257,9 @@  discard block
 block discarded – undo
254 257
 		return $this;
255 258
 	}
256 259
 
260
+	/**
261
+	 * @param integer $index
262
+	 */
257 263
 	public static function setIndex($index) {
258 264
 		self::$index=$index;
259 265
 	}
@@ -313,7 +319,7 @@  discard block
 block discarded – undo
313 319
 	 * The $callback function can take the following arguments : $field=>the compiled field, $instance : the active instance of the object, $index: the field position
314 320
 	 * @param int $index postion of the compiled field
315 321
 	 * @param callable $callback function called after the field compilation
316
-	 * @return \Ajax\semantic\widgets\datatable\InstanceViewer
322
+	 * @return InstanceViewer
317 323
 	 */
318 324
 	public function afterCompile($index,$callback){
319 325
 		$this->afterCompile[$index]=$callback;
Please login to merge, or discard this patch.
Ajax/semantic/components/Sticky.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 		return $this->setParam("context", $value);
22 22
 	}
23 23
 
24
-	public function setOffset($offset=0){
24
+	public function setOffset($offset=0) {
25 25
 		return $this->setParam("offset", $offset);
26 26
 	}
27 27
 }
Please login to merge, or discard this patch.