Completed
Push — master ( 5b3666...b3a3fe )
by Jean-Christophe
04:35
created
Ajax/semantic/html/content/table/HtmlTR.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -20,12 +20,12 @@  discard block
 block discarded – undo
20 20
 
21 21
 	public function __construct($identifier) {
22 22
 		parent::__construct($identifier, "tr", "");
23
-		$this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ];
23
+		$this->_states=[State::ACTIVE, State::POSITIVE, State::NEGATIVE, State::WARNING, State::ERROR, State::DISABLED];
24 24
 	}
25 25
 
26 26
 	public function setColCount($colCount) {
27 27
 		$count=$this->count();
28
-		for($i=$count; $i < $colCount; $i++) {
28
+		for ($i=$count; $i<$colCount; $i++) {
29 29
 			$item=$this->addItem(NULL);
30 30
 			$item->setTagName($this->_tdTagName);
31 31
 		}
@@ -65,16 +65,16 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	public function setValues($values=array()) {
67 67
 		$count=$this->count();
68
-		if (\is_array($values) === false) {
68
+		if (\is_array($values)===false) {
69 69
 			$values=\array_fill(0, $count, $values);
70
-		} else {
71
-			if (JArray::isAssociative($values) === true) {
70
+		}else {
71
+			if (JArray::isAssociative($values)===true) {
72 72
 				$values=\array_values($values);
73 73
 			}
74 74
 		}
75 75
 		$count=\min(\sizeof($values), $count);
76 76
 		
77
-		for($i=0; $i < $count; $i++) {
77
+		for ($i=0; $i<$count; $i++) {
78 78
 			$cell=$this->content[$i];
79 79
 			$cell->setValue($values[$i]);
80 80
 		}
@@ -101,20 +101,20 @@  discard block
 block discarded – undo
101 101
 	public function getColPosition($colIndex) {
102 102
 		$pos=0;
103 103
 		$rows=$this->_container->getContent();
104
-		for($i=0; $i < $this->_row; $i++) {
104
+		for ($i=0; $i<$this->_row; $i++) {
105 105
 			$max=\min($colIndex, $rows[$i]->count());
106
-			for($j=0; $j < $max; $j++) {
106
+			for ($j=0; $j<$max; $j++) {
107 107
 				$rowspan=$rows[$i]->getItem($j)->getRowspan();
108
-				if ($rowspan + $i > $this->_row)
108
+				if ($rowspan+$i>$this->_row)
109 109
 					$pos++;
110 110
 			}
111 111
 		}
112
-		if ($pos > $colIndex)
112
+		if ($pos>$colIndex)
113 113
 			return NULL;
114 114
 		$count=$this->count();
115
-		for($i=0; $i < $count; $i++) {
115
+		for ($i=0; $i<$count; $i++) {
116 116
 			$pos+=$this->content[$i]->getColspan();
117
-			if ($pos >= $colIndex + 1)
117
+			if ($pos>=$colIndex+1)
118 118
 				return $i;
119 119
 		}
120 120
 		return null;
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
 	public function conditionalCellFormat($callback, $format) {
124 124
 		$cells=$this->content;
125
-		foreach ( $cells as $cell ) {
125
+		foreach ($cells as $cell) {
126 126
 			$cell->conditionalCellFormat($callback, $format);
127 127
 		}
128 128
 		return $this;
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
 
138 138
 	public function containsStr($needle) {
139 139
 		$cells=$this->content;
140
-		foreach ( $cells as $cell ) {
141
-			if (\strpos($cell->getContent(), $needle) !== false)
140
+		foreach ($cells as $cell) {
141
+			if (\strpos($cell->getContent(), $needle)!==false)
142 142
 				return true;
143 143
 		}
144 144
 		return false;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
 	public function applyCells($callback) {
153 153
 		$cells=$this->content;
154
-		foreach ( $cells as $cell ) {
154
+		foreach ($cells as $cell) {
155 155
 			$cell->apply($callback);
156 156
 		}
157 157
 		return $this;
Please login to merge, or discard this patch.
Ajax/semantic/html/content/table/HtmlTD.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 use Ajax\semantic\html\elements\html5\HtmlLink;
11 11
 
12 12
 class HtmlTD extends HtmlSemDoubleElement {
13
-	use TextAlignmentTrait,TableElementTrait;
13
+	use TextAlignmentTrait, TableElementTrait;
14 14
 	private $_container;
15 15
 	private $_row;
16 16
 	private $_col;
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function __construct($identifier, $content=NULL, $tagName="td") {
25 25
 		parent::__construct($identifier, $tagName, "", $content);
26
-		$this->_variations=[ Variation::COLLAPSING ];
27
-		$this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ];
26
+		$this->_variations=[Variation::COLLAPSING];
27
+		$this->_states=[State::ACTIVE, State::POSITIVE, State::NEGATIVE, State::WARNING, State::ERROR, State::DISABLED];
28 28
 	}
29 29
 
30 30
 	public function setContainer($container, $row, $col) {
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 	}
40 40
 
41 41
 	public function setRowspan($rowspan) {
42
-		$to=min($this->_container->count(), $this->_row + $rowspan - 1);
43
-		for($i=$to; $i > $this->_row; $i--) {
42
+		$to=min($this->_container->count(), $this->_row+$rowspan-1);
43
+		for ($i=$to; $i>$this->_row; $i--) {
44 44
 			$this->_container->delete($i, $this->_col);
45 45
 		}
46 46
 		$this->setProperty("rowspan", $rowspan);
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 	}
57 57
 
58 58
 	public function setColspan($colspan) {
59
-		$to=min($this->_container->getRow($this->_row)->count(), $this->_col + $colspan - 1);
60
-		for($i=$to; $i > $this->_col; $i--) {
61
-			$this->_container->delete($this->_row, $this->_col + 1);
59
+		$to=min($this->_container->getRow($this->_row)->count(), $this->_col+$colspan-1);
60
+		for ($i=$to; $i>$this->_col; $i--) {
61
+			$this->_container->delete($this->_row, $this->_col+1);
62 62
 		}
63 63
 		$this->setProperty("colspan", $colspan);
64 64
 		return $this->_container;
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlButtonGroups.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
 
15 15
 	public function __construct($identifier, $elements=array(), $asIcons=false) {
16 16
 		parent::__construct($identifier, "div", "ui buttons");
17
-		$this->content=array ();
18
-		if ($asIcons === true)
17
+		$this->content=array();
18
+		if ($asIcons===true)
19 19
 			$this->asIcons();
20 20
 		$this->addElements($elements, $asIcons);
21 21
 	}
@@ -24,25 +24,25 @@  discard block
 block discarded – undo
24 24
 		$elementO=$element;
25 25
 		if (\is_string($element)) {
26 26
 			if ($asIcon) {
27
-				$elementO=new HtmlButton("button-" . $this->identifier . "-" . \sizeof($this->content));
27
+				$elementO=new HtmlButton("button-".$this->identifier."-".\sizeof($this->content));
28 28
 				$elementO->asIcon($element);
29
-			} else
30
-				$elementO=new HtmlButton("button-" . $this->identifier . "-" . \sizeof($this->content), $element);
29
+			}else
30
+				$elementO=new HtmlButton("button-".$this->identifier."-".\sizeof($this->content), $element);
31 31
 		}
32 32
 		$this->addContent($elementO);
33 33
 	}
34 34
 
35 35
 	public function addElements($elements, $asIcons=false) {
36
-		foreach ( $elements as $element ) {
36
+		foreach ($elements as $element) {
37 37
 			$this->addElement($element, $asIcons);
38 38
 		}
39 39
 		return $this;
40 40
 	}
41 41
 
42 42
 	public function insertOr($aferIndex=0, $or="or") {
43
-		$orElement=new HtmlSemDoubleElement("or-" . $this->identifier, "div", "or");
43
+		$orElement=new HtmlSemDoubleElement("or-".$this->identifier, "div", "or");
44 44
 		$orElement->setProperty("data-text", $or);
45
-		array_splice($this->content, $aferIndex + 1, 0, array ($orElement ));
45
+		array_splice($this->content, $aferIndex+1, 0, array($orElement));
46 46
 		return $this;
47 47
 	}
48 48
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	}
56 56
 
57 57
 	public function asIcons() {
58
-		foreach ( $this->content as $item ) {
58
+		foreach ($this->content as $item) {
59 59
 			$item->asIcon($item->getContent());
60 60
 		}
61 61
 		return $this->addToProperty("class", "icons");
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @see \Ajax\bootstrap\html\base\BaseHtml::on()
94 94
 	 */
95 95
 	public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) {
96
-		foreach ( $this->content as $element ) {
96
+		foreach ($this->content as $element) {
97 97
 			$element->on($event, $jsCode, $stopPropagation, $preventDefault);
98 98
 		}
99 99
 		return $this;
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 
106 106
 	public function addClasses($classes=array()) {
107 107
 		$i=0;
108
-		foreach ( $this->content as $button ) {
108
+		foreach ($this->content as $button) {
109 109
 			$button->addToProperty("class", $classes[$i++]);
110 110
 		}
111 111
 		return $this;
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlProgress.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -9,26 +9,26 @@  discard block
 block discarded – undo
9 9
 use Ajax\semantic\html\base\constants\State;
10 10
 
11 11
 class HtmlProgress extends HtmlSemDoubleElement {
12
-	private $_params=array ();
12
+	private $_params=array();
13 13
 
14 14
 	public function __construct($identifier, $value=NULL, $label=NULL, $attributes=array()) {
15 15
 		parent::__construct($identifier, "div", "ui progress");
16
-		if (isset($value) === true)
16
+		if (isset($value)===true)
17 17
 			$this->setProperty("data-percent", $value);
18 18
 		$this->createBar();
19
-		if (isset($label) === true)
19
+		if (isset($label)===true)
20 20
 			$this->setLabel($label);
21
-		$this->_states=[ State::SUCCESS,State::WARNING,State::ERROR,State::ACTIVE,State::DISABLED ];
21
+		$this->_states=[State::SUCCESS, State::WARNING, State::ERROR, State::ACTIVE, State::DISABLED];
22 22
 		$this->addToProperty("class", $attributes);
23 23
 	}
24 24
 
25 25
 	public function setLabel($label) {
26
-		$this->content["label"]=new HtmlSemDoubleElement("lbl-" . $this->identifier, "div", "label", $label);
26
+		$this->content["label"]=new HtmlSemDoubleElement("lbl-".$this->identifier, "div", "label", $label);
27 27
 		return $this;
28 28
 	}
29 29
 
30 30
 	private function createBar() {
31
-		$bar=new HtmlSemDoubleElement("bar-" . $this->identifier, "div", "bar", new HtmlSemDoubleElement("progress-" . $this->identifier, "div", "progress"));
31
+		$bar=new HtmlSemDoubleElement("bar-".$this->identifier, "div", "bar", new HtmlSemDoubleElement("progress-".$this->identifier, "div", "progress"));
32 32
 		$this->content["bar"]=$bar;
33 33
 		return $this;
34 34
 	}
@@ -68,20 +68,20 @@  discard block
 block discarded – undo
68 68
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile()
69 69
 	 */
70 70
 	public function compile(JsUtils $js=NULL, View $view=NULL) {
71
-		$this->content=JArray::sortAssociative($this->content, [ "bar","label" ]);
71
+		$this->content=JArray::sortAssociative($this->content, ["bar", "label"]);
72 72
 		return parent::compile($js, $view);
73 73
 	}
74 74
 
75 75
 	public function jsSetValue($value) {
76
-		return '$("#' . $this->identifier . '").progress({value:' . $value . '});';
76
+		return '$("#'.$this->identifier.'").progress({value:'.$value.'});';
77 77
 	}
78 78
 
79 79
 	public function jsIncValue() {
80
-		return '$("#' . $this->identifier . '").progress("increment");';
80
+		return '$("#'.$this->identifier.'").progress("increment");';
81 81
 	}
82 82
 
83 83
 	public function jsDecValue() {
84
-		return '$("#' . $this->identifier . '").progress("decrement");';
84
+		return '$("#'.$this->identifier.'").progress("decrement");';
85 85
 	}
86 86
 
87 87
 	/**
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @return HtmlProgress
96 96
 	 */
97 97
 	public function setTextValues($active=false, $error=false, $success=false, $warning=false, $percent="{percent}%", $ratio="{value} of {total}") {
98
-		if (\is_array($active) == true) {
98
+		if (\is_array($active)==true) {
99 99
 			$array=$active;
100 100
 			$active=JArray::getDefaultValue($array, "active", false);
101 101
 			$success=JArray::getDefaultValue($array, "success", $success);
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
 			$percent=JArray::getDefaultValue($array, "percent", $percent);
104 104
 			$ratio=JArray::getDefaultValue($array, "ratio", $ratio);
105 105
 		}
106
-		$this->_params["text"]="%{active  : " . \var_export($active, true) . ",error: " . \var_export($error, true) . ",success : " . \var_export($success, true) . ",warning : " . \var_export($warning, true) . ",percent : " . \var_export($percent, true) . ",ratio   : " . \var_export($ratio, true) . "}%";
106
+		$this->_params["text"]="%{active  : ".\var_export($active, true).",error: ".\var_export($error, true).",success : ".\var_export($success, true).",warning : ".\var_export($warning, true).",percent : ".\var_export($percent, true).",ratio   : ".\var_export($ratio, true)."}%";
107 107
 		return $this;
108 108
 	}
109 109
 
110 110
 	public function onChange($jsCode) {
111
-		return $this->_params["onChange"]="%function(percent, value, total){" . $jsCode . "}%";
111
+		return $this->_params["onChange"]="%function(percent, value, total){".$jsCode."}%";
112 112
 	}
113 113
 
114 114
 	/*
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
 	 * @see BaseHtml::run()
117 117
 	 */
118 118
 	public function run(JsUtils $js) {
119
-		if (isset($this->_bsComponent) === false)
120
-			$this->_bsComponent=$js->semantic()->progress("#" . $this->identifier, $this->_params);
119
+		if (isset($this->_bsComponent)===false)
120
+			$this->_bsComponent=$js->semantic()->progress("#".$this->identifier, $this->_params);
121 121
 		$this->addEventsOnRun($js);
122 122
 		return $this->_bsComponent;
123 123
 	}
Please login to merge, or discard this patch.
Ajax/common/components/SimpleComponent.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
 
17 17
 	public function __construct(JsUtils $js) {
18 18
 		parent::__construct($js);
19
-		$this->events=array ();
19
+		$this->events=array();
20 20
 	}
21 21
 
22 22
 	protected function compileEvents() {
23
-		foreach ( $this->events as $event => $jsCode ) {
24
-			if($event=="execute"){
23
+		foreach ($this->events as $event => $jsCode) {
24
+			if ($event=="execute") {
25 25
 				$this->jquery_code_for_compile []=$jsCode;
26
-			}else if($event=="beforeExecute"){
26
+			}else if ($event=="beforeExecute") {
27 27
 				\array_unshift($this->jquery_code_for_compile, $jsCode);
28 28
 			}else
29 29
 				$this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});";
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		$result=implode("\n", $this->jquery_code_for_compile);
35 35
 		$result=str_ireplace("\"%", "", $result);
36 36
 		$result=str_ireplace("%\"", "", $result);
37
-		$result=str_replace(array (
37
+		$result=str_replace(array(
38 38
 				"\\n",
39 39
 				"\\r",
40 40
 				"\\t"
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 	public function getScript() {
46 46
 		$allParams=$this->params;
47
-		$this->jquery_code_for_compile=array ();
47
+		$this->jquery_code_for_compile=array();
48 48
 		$this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).{$this->uiName}(".$this->getParamsAsJSON($allParams).");";
49 49
 		$this->compileEvents();
50 50
 		return $this->compileJQueryCode();
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 		if (is_array($typeCtrl)) {
72 72
 			if (array_search($value, $typeCtrl)===false)
73 73
 				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)."}");
74
-		} else {
74
+		}else {
75 75
 			if (!$typeCtrl($value)) {
76 76
 				throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." au composant ".$this->uiName);
77 77
 			}
Please login to merge, or discard this patch.
Ajax/semantic/components/search/SearchCategory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	}
25 25
 
26 26
 	public function __toString() {
27
-		$result="\"" . $this->id . "\": { \"name\": \"" . $this->name . "\"," . $this->results . "}";
27
+		$result="\"".$this->id."\": { \"name\": \"".$this->name."\",".$this->results."}";
28 28
 		return $result;
29 29
 	}
30 30
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
 	public function search($query, $field="title") {
59 59
 		$result=$this->results->search($query, $field);
60
-		if ($result !== false) {
60
+		if ($result!==false) {
61 61
 			return new SearchCategory($this->id, $this->name, $result);
62 62
 		}
63 63
 		return false;
Please login to merge, or discard this patch.
Ajax/semantic/components/search/SearchCategories.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -6,25 +6,25 @@  discard block
 block discarded – undo
6 6
 	private $categories;
7 7
 
8 8
 	public function __construct() {
9
-		$this->categories=array ();
9
+		$this->categories=array();
10 10
 	}
11 11
 
12 12
 	public function add($results, $category) {
13 13
 		$count=\sizeof($this->categories);
14 14
 		if (\array_key_exists($category, $this->categories)) {
15 15
 			$this->categories[$category]->addResults($results);
16
-		} else {
17
-			$categoryO=new SearchCategory("category" . $count, $category, $results);
16
+		}else {
17
+			$categoryO=new SearchCategory("category".$count, $category, $results);
18 18
 			$this->categories[$category]=$categoryO;
19 19
 		}
20 20
 		return $this;
21 21
 	}
22 22
 
23 23
 	public function search($query, $field="title") {
24
-		$result=array ();
25
-		foreach ( $this->categories as $category ) {
24
+		$result=array();
25
+		foreach ($this->categories as $category) {
26 26
 			$r=$category->search($query, $field);
27
-			if ($r !== false)
27
+			if ($r!==false)
28 28
 				$result[]=$r;
29 29
 		}
30 30
 		$this->categories=$result;
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	}
33 33
 
34 34
 	public function __toString() {
35
-		return "{\"results\":{" . \implode(",", \array_values($this->categories)) . "}}";
35
+		return "{\"results\":{".\implode(",", \array_values($this->categories))."}}";
36 36
 	}
37 37
 
38 38
 	public function getResponse() {
Please login to merge, or discard this patch.
Ajax/semantic/components/search/AbstractSearchResult.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 
7 7
 	public function fromDatabaseObjects($objects, $function) {
8 8
 		if (isset($objects)) {
9
-			foreach ( $objects as $object ) {
9
+			foreach ($objects as $object) {
10 10
 				$this->fromDatabaseObject($object, $function);
11 11
 			}
12 12
 		}
Please login to merge, or discard this patch.
Ajax/semantic/components/search/SearchResult.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 	public function __construct($id=NULL, $title=NULL, $description=NULL, $image=NULL, $price=NULL) {
13 13
 		if (\is_array($id)) {
14 14
 			$this->fromArray($id);
15
-		} else {
15
+		}else {
16 16
 			$this->id=$id;
17 17
 			$this->title=$title;
18 18
 			$this->description=$description;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	}
68 68
 
69 69
 	public function fromArray($array) {
70
-		foreach ( $array as $key => $value ) {
70
+		foreach ($array as $key => $value) {
71 71
 			$this->{$key}=$value;
72 72
 		}
73 73
 		return $this;
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 
80 80
 	public function JsonSerialize() {
81 81
 		$vars=get_object_vars($this);
82
-		$result=array ();
83
-		foreach ( $vars as $k => $v ) {
82
+		$result=array();
83
+		foreach ($vars as $k => $v) {
84 84
 			if (isset($v))
85 85
 				$result[$k]=$v;
86 86
 		}
@@ -89,6 +89,6 @@  discard block
 block discarded – undo
89 89
 
90 90
 	public function search($query, $field="title") {
91 91
 		$value=$this->$field;
92
-		return \stripos($value, $query) !== false;
92
+		return \stripos($value, $query)!==false;
93 93
 	}
94 94
 }
95 95
\ No newline at end of file
Please login to merge, or discard this patch.