Completed
Push — master ( a4feba...3ad5ef )
by Jean-Christophe
03:50
created
Ajax/semantic/html/collections/table/HtmlTable.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -271,8 +271,9 @@  discard block
 block discarded – undo
271 271
 			$result= $this->getBody()->_addRow($result);
272 272
 		}
273 273
 		if(isset($this->_afterCompileEvents["onNewRow"])){
274
-			if(\is_callable($this->_afterCompileEvents["onNewRow"]))
275
-				$this->_afterCompileEvents["onNewRow"]($result,$object);
274
+			if(\is_callable($this->_afterCompileEvents["onNewRow"])) {
275
+							$this->_afterCompileEvents["onNewRow"]($result,$object);
276
+			}
276 277
 		}
277 278
 		return $result;
278 279
 	}
@@ -293,8 +294,9 @@  discard block
 block discarded – undo
293 294
 
294 295
 	public function run(JsUtils $js){
295 296
 		$result= parent::run($js);
296
-		if(isset($this->_footer))
297
-			$this->_footer->run($js);
297
+		if(isset($this->_footer)) {
298
+					$this->_footer->run($js);
299
+		}
298 300
 		return $result;
299 301
 	}
300 302
 
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 
28 28
 	public function __construct($identifier, $rowCount, $colCount) {
29 29
 		parent::__construct($identifier, "table", "ui table");
30
-		$this->content=array ();
30
+		$this->content=array();
31 31
 		$this->setRowCount($rowCount, $colCount);
32
-		$this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ];
33
-		$this->_compileParts=["thead","tbody","tfoot"];
32
+		$this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT];
33
+		$this->_compileParts=["thead", "tbody", "tfoot"];
34 34
 		$this->_afterCompileEvents=[];
35 35
 	}
36 36
 
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 	 * @return HtmlTableContent
49 49
 	 */
50 50
 	public function getPart($key) {
51
-		if (\array_key_exists($key, $this->content) === false) {
51
+		if (\array_key_exists($key, $this->content)===false) {
52 52
 			$this->content[$key]=new HtmlTableContent("", $key);
53
-			if ($key !== "tbody") {
53
+			if ($key!=="tbody") {
54 54
 				$this->content[$key]->setRowCount(1, $this->_colCount);
55 55
 			}
56 56
 		}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @return boolean
96 96
 	 */
97 97
 	public function hasPart($key) {
98
-		return \array_key_exists($key, $this->content) === true;
98
+		return \array_key_exists($key, $this->content)===true;
99 99
 	}
100 100
 
101 101
 	/**
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 
201 201
 	private function colAlign($colIndex, $function) {
202 202
 		if (\is_array($colIndex)) {
203
-			foreach ( $colIndex as $cIndex ) {
203
+			foreach ($colIndex as $cIndex) {
204 204
 				$this->colAlign($cIndex, $function);
205 205
 			}
206 206
 		} else {
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile()
240 240
 	 */
241 241
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
242
-		if(\sizeof($this->_compileParts)<3){
242
+		if (\sizeof($this->_compileParts)<3) {
243 243
 			$this->_template="%content%";
244 244
 			$this->refresh();
245 245
 		}
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
 
250 250
 	protected function compile_once(JsUtils $js=NULL, &$view=NULL) {
251 251
 		if ($this->propertyContains("class", "sortable")) {
252
-			$this->addEvent("execute", "$('#" . $this->identifier . "').tablesort().data('tablesort').sort($('th.default-sort'));");
252
+			$this->addEvent("execute", "$('#".$this->identifier."').tablesort().data('tablesort').sort($('th.default-sort'));");
253 253
 		}
254
-		if(isset($this->_activeRowSelector)){
254
+		if (isset($this->_activeRowSelector)) {
255 255
 			$this->_activeRowSelector->compile();
256 256
 		}
257 257
 	}
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
 	public function fromDatabaseObject($object, $function) {
266 266
 		$result=$function($object);
267 267
 		if (\is_array($result)) {
268
-			$result= $this->addRow($function($object));
268
+			$result=$this->addRow($function($object));
269 269
 		} else {
270
-			$result= $this->getBody()->_addRow($result);
270
+			$result=$this->getBody()->_addRow($result);
271 271
 		}
272
-		if(isset($this->_afterCompileEvents["onNewRow"])){
273
-			if(\is_callable($this->_afterCompileEvents["onNewRow"]))
274
-				$this->_afterCompileEvents["onNewRow"]($result,$object);
272
+		if (isset($this->_afterCompileEvents["onNewRow"])) {
273
+			if (\is_callable($this->_afterCompileEvents["onNewRow"]))
274
+				$this->_afterCompileEvents["onNewRow"]($result, $object);
275 275
 		}
276 276
 		return $result;
277 277
 	}
@@ -285,14 +285,14 @@  discard block
 block discarded – undo
285 285
 		return $this;
286 286
 	}
287 287
 
288
-	public function refresh(){
288
+	public function refresh() {
289 289
 		$this->_footer=$this->getFooter();
290 290
 		$this->addEvent("execute", '$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");');
291 291
 	}
292 292
 
293
-	public function run(JsUtils $js){
294
-		$result= parent::run($js);
295
-		if(isset($this->_footer))
293
+	public function run(JsUtils $js) {
294
+		$result=parent::run($js);
295
+		if (isset($this->_footer))
296 296
 			$this->_footer->run($js);
297 297
 		return $result;
298 298
 	}
@@ -308,8 +308,8 @@  discard block
 block discarded – undo
308 308
 		return $this;
309 309
 	}
310 310
 
311
-	public function setActiveRowSelector($class="active",$event="click",$multiple=false){
312
-		$this->_activeRowSelector=new ActiveRow($this,$class,$event,$multiple);
311
+	public function setActiveRowSelector($class="active", $event="click", $multiple=false) {
312
+		$this->_activeRowSelector=new ActiveRow($this, $class, $event, $multiple);
313 313
 		return $this;
314 314
 	}
315 315
 }
316 316
\ No newline at end of file
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
@@ -19,28 +19,28 @@  discard block
 block discarded – undo
19 19
 
20 20
 	public function __construct(JsUtils $js=NULL) {
21 21
 		parent::__construct($js);
22
-		$this->events=array ();
22
+		$this->events=array();
23 23
 	}
24 24
 
25 25
 	protected function compileEvents() {
26
-		foreach ( $this->events as $event => $jsCode ) {
26
+		foreach ($this->events as $event => $jsCode) {
27 27
 			$itemSelector=JString::getValueBetween($event);
28 28
 			//echo $itemSelector.":::".$jsCode."<br>";
29
-			if($event=="execute"){
29
+			if ($event=="execute") {
30 30
 				$this->jquery_code_for_compile []=$jsCode;
31
-			}else if($event=="beforeExecute"){
31
+			} else if ($event=="beforeExecute") {
32 32
 				\array_unshift($this->jquery_code_for_compile, $jsCode);
33
-			}else{
33
+			} else {
34 34
 				$selector=$this->_createSelector($itemSelector, $this->attachTo);
35 35
 				$this->jquery_code_for_compile []="$( \"".$selector."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});";
36 36
 			}
37 37
 		}
38 38
 	}
39 39
 
40
-	protected function _createSelector($itemSelector,$selector){
41
-		if(!isset($itemSelector))
40
+	protected function _createSelector($itemSelector, $selector) {
41
+		if (!isset($itemSelector))
42 42
 			$itemSelector=$this->itemSelector;
43
-		if(isset($itemSelector) && $itemSelector!=="")
43
+		if (isset($itemSelector) && $itemSelector!=="")
44 44
 			$selector.=" ".$itemSelector;
45 45
 		return $selector;
46 46
 	}
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		$result=implode("\n", $this->jquery_code_for_compile);
50 50
 		$result=str_ireplace("\"%", "", $result);
51 51
 		$result=str_ireplace("%\"", "", $result);
52
-		$result=str_replace(array (
52
+		$result=str_replace(array(
53 53
 				"\\n",
54 54
 				"\\r",
55 55
 				"\\t"
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
 	public function getScript() {
61 61
 		$allParams=$this->params;
62
-		$this->jquery_code_for_compile=array ();
62
+		$this->jquery_code_for_compile=array();
63 63
 		$this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).{$this->uiName}(".$this->getParamsAsJSON($allParams).");";
64 64
 		$this->compileEvents();
65 65
 		return $this->compileJQueryCode();
Please login to merge, or discard this patch.
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 			//echo $itemSelector.":::".$jsCode."<br>";
29 29
 			if($event=="execute"){
30 30
 				$this->jquery_code_for_compile []=$jsCode;
31
-			}else if($event=="beforeExecute"){
31
+			} else if($event=="beforeExecute"){
32 32
 				\array_unshift($this->jquery_code_for_compile, $jsCode);
33
-			}else{
33
+			} else{
34 34
 				$selector=$this->_createSelector($itemSelector, $this->attachTo);
35 35
 				$this->jquery_code_for_compile []="$( \"".$selector."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});";
36 36
 			}
@@ -38,10 +38,12 @@  discard block
 block discarded – undo
38 38
 	}
39 39
 
40 40
 	protected function _createSelector($itemSelector,$selector){
41
-		if(!isset($itemSelector))
42
-			$itemSelector=$this->itemSelector;
43
-		if(isset($itemSelector) && $itemSelector!=="")
44
-			$selector.=" ".$itemSelector;
41
+		if(!isset($itemSelector)) {
42
+					$itemSelector=$this->itemSelector;
43
+		}
44
+		if(isset($itemSelector) && $itemSelector!=="") {
45
+					$selector.=" ".$itemSelector;
46
+		}
45 47
 		return $selector;
46 48
 	}
47 49
 
@@ -84,8 +86,9 @@  discard block
 block discarded – undo
84 86
 
85 87
 	protected function setParamCtrl($key, $value, $typeCtrl) {
86 88
 		if (\is_array($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
+			if (array_search($value, $typeCtrl)===false) {
90
+							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)."}");
91
+			}
89 92
 		} else {
90 93
 			if (!$typeCtrl($value)) {
91 94
 				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/service/JString.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -2,63 +2,63 @@
 block discarded – undo
2 2
 namespace Ajax\service;
3 3
 class JString {
4 4
 
5
-	public static function contains($hay,$needle){
6
-		return strpos($hay, $needle) !== false;
5
+	public static function contains($hay, $needle) {
6
+		return strpos($hay, $needle)!==false;
7 7
 	}
8 8
 	public static function startswith($hay, $needle) {
9
-		return substr($hay, 0, strlen($needle)) === $needle;
9
+		return substr($hay, 0, strlen($needle))===$needle;
10 10
 	}
11 11
 
12 12
 	public static function endswith($hay, $needle) {
13
-		return substr($hay, -strlen($needle)) === $needle;
13
+		return substr($hay, -strlen($needle))===$needle;
14 14
 	}
15 15
 
16
-	public static function isNull($s){
16
+	public static function isNull($s) {
17 17
 		return (!isset($s) || NULL===$s || ""===$s);
18 18
 	}
19
-	public static function isNotNull($s){
19
+	public static function isNotNull($s) {
20 20
 		return (isset($s) && NULL!==$s && ""!==$s);
21 21
 	}
22 22
 
23
-	public static function isBoolean($value){
23
+	public static function isBoolean($value) {
24 24
 		return \is_bool($value) || $value==1 || $value==0;
25 25
 	}
26 26
 
27
-	public static function isBooleanTrue($value){
27
+	public static function isBooleanTrue($value) {
28 28
 		return $value==1 || $value;
29 29
 	}
30 30
 
31
-	public static function isBooleanFalse($value){
31
+	public static function isBooleanFalse($value) {
32 32
 		return $value==0 || !$value;
33 33
 	}
34 34
 
35
-	public static function camelCaseToSeparated($input,$separator=" "){
35
+	public static function camelCaseToSeparated($input, $separator=" ") {
36 36
 		return strtolower(preg_replace('/(?<!^)[A-Z]/', $separator.'$0', $input));
37 37
 	}
38 38
 
39
-	public static function replaceAtFirst($subject,$from, $to){
40
-		$from = '/\A'.preg_quote($from, '/').'/';
39
+	public static function replaceAtFirst($subject, $from, $to) {
40
+		$from='/\A'.preg_quote($from, '/').'/';
41 41
 		return \preg_replace($from, $to, $subject, 1);
42 42
 	}
43 43
 
44
-	public static function replaceAtLast($subject,$from, $to){
45
-		$from = '/'.preg_quote($from, '/').'\z/';
44
+	public static function replaceAtLast($subject, $from, $to) {
45
+		$from='/'.preg_quote($from, '/').'\z/';
46 46
 		return \preg_replace($from, $to, $subject, 1);
47 47
 	}
48 48
 
49
-	public static function replaceAtFirstAndLast($subject,$fromFirst,$toFirst,$fromLast,$toLast){
49
+	public static function replaceAtFirstAndLast($subject, $fromFirst, $toFirst, $fromLast, $toLast) {
50 50
 		$s=self::replaceAtFirst($subject, $fromFirst, $toFirst);
51 51
 		return self::replaceAtLast($s, $fromLast, $toLast);
52 52
 	}
53 53
 
54
-	public static function getValueBetween(&$str,$before="{{",$after="}}"){
54
+	public static function getValueBetween(&$str, $before="{{", $after="}}") {
55 55
 		$matches=[];
56 56
 		$result=null;
57 57
 		$_before=\preg_quote($before);
58 58
 		$_after=\preg_quote($after);
59
-		if(\preg_match('/'.$_before.'(.*?)'.$_after.'/s', $str, $matches)===1){
59
+		if (\preg_match('/'.$_before.'(.*?)'.$_after.'/s', $str, $matches)===1) {
60 60
 			$result=$matches[1];
61
-			$str=\str_replace($before.$result.$after,"", $str);
61
+			$str=\str_replace($before.$result.$after, "", $str);
62 62
 		}
63 63
 		return $result;
64 64
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/table/ActiveRow.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 * @param string $event
22 22
 	 * @param boolean $multiple
23 23
 	 */
24
-	public function __construct($table,$class="active",$event="click",$multiple=false){
24
+	public function __construct($table, $class="active", $event="click", $multiple=false) {
25 25
 		$this->table=$table;
26 26
 		$this->class=$class;
27 27
 		$this->event=$event;
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
 		return $this;
56 56
 	}
57 57
 
58
-	public function compile(){
58
+	public function compile() {
59 59
 		$multiple="";
60
-		if(!$this->multiple){
60
+		if (!$this->multiple) {
61 61
 			$multiple="$(this).closest('tbody').children('tr').removeClass('".$this->class."');";
62 62
 		}
63
-		$this->table->onRow($this->event, $multiple."$(this).toggleClass('".$this->class."');",false,false);
63
+		$this->table->onRow($this->event, $multiple."$(this).toggleClass('".$this->class."');", false, false);
64 64
 	}
65 65
 
66 66
 }
67 67
\ No newline at end of file
Please login to merge, or discard this patch.