Completed
Push — master ( 7ed867...85d12a )
by Jean-Christophe
02:44
created
Ajax/semantic/widgets/business/user/FormAccount.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -10,61 +10,61 @@
 block discarded – undo
10 10
 	 * @param string $identifier
11 11
 	 * @param object $modelInstance
12 12
 	 */
13
-	public function __construct($identifier,$modelInstance=null,$fieldsOrder=[],$fieldsDefinition=[],$fields=[],$captions=[],$separators=[]) {
14
-		parent::__construct($identifier,$modelInstance,$fieldsOrder,$fieldsDefinition,$fields,$captions,$separators);
13
+	public function __construct($identifier, $modelInstance=null, $fieldsOrder=[], $fieldsDefinition=[], $fields=[], $captions=[], $separators=[]) {
14
+		parent::__construct($identifier, $modelInstance, $fieldsOrder, $fieldsDefinition, $fields, $captions, $separators);
15 15
 	}
16 16
 
17
-	protected function getDefaultModelInstance(){
17
+	protected function getDefaultModelInstance() {
18 18
 		return new UserModel();
19 19
 	}
20 20
 
21
-	public static function regular($identifier,$modelInstance=null){
22
-		return new FormAccount($identifier,$modelInstance,
23
-				["message","login","password","passwordConf","email","submit","error"],
21
+	public static function regular($identifier, $modelInstance=null) {
22
+		return new FormAccount($identifier, $modelInstance,
23
+				["message", "login", "password", "passwordConf", "email", "submit", "error"],
24 24
 				["message"=>[["icon"=>"sign in"]],
25 25
 						"input0"=>[["rules"=>"empty"]],
26
-						"input1"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty']]],
27
-						"input2"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty', 'match[password]']]],
26
+						"input1"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty']]],
27
+						"input2"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty', 'match[password]']]],
28 28
 						"input3"=>[["rules"=>"email"]],
29 29
 						"submit"=>["green fluid"],
30 30
 						"message2"=>[["error"=>true]]],
31
-				["Account","login","password","passwordConf","email","submit","error"],
32
-				["Please enter your account informations","Login","Password","Password confirmation","Email address","Creation"],
33
-				[0,1,3,4,5,6]);
31
+				["Account", "login", "password", "passwordConf", "email", "submit", "error"],
32
+				["Please enter your account informations", "Login", "Password", "Password confirmation", "Email address", "Creation"],
33
+				[0, 1, 3, 4, 5, 6]);
34 34
 	}
35 35
 
36
-	public static function smallInline($identifier,$modelInstance=null){
37
-		$result=new FormAccount($identifier,$modelInstance,
38
-				["login","password","submit"],
39
-				["input0"=>[["rules"=>"empty"]],"input1"=>[["inputType"=>"password","rules"=>"empty"]],"submit"=>["green basic"]],
40
-				["login","password","submit"],
41
-				["","","Connection"],
36
+	public static function smallInline($identifier, $modelInstance=null) {
37
+		$result=new FormAccount($identifier, $modelInstance,
38
+				["login", "password", "submit"],
39
+				["input0"=>[["rules"=>"empty"]], "input1"=>[["inputType"=>"password", "rules"=>"empty"]], "submit"=>["green basic"]],
40
+				["login", "password", "submit"],
41
+				["", "", "Connection"],
42 42
 				[2]);
43 43
 			$result->addDividerBefore(0, "Connection");
44 44
 		return $result;
45 45
 	}
46 46
 
47
-	public static function small($identifier,$modelInstance=null){
48
-		$result=new FormAccount($identifier,$modelInstance,
49
-				["login","password","passwordConf","email","submit"],
47
+	public static function small($identifier, $modelInstance=null) {
48
+		$result=new FormAccount($identifier, $modelInstance,
49
+				["login", "password", "passwordConf", "email", "submit"],
50 50
 				[
51 51
 						"input0"=>[["rules"=>"empty"]],
52
-						"input1"=>[["inputType"=>"password","rules"=>['minLength[6]', 'empty']]],
53
-						"input2"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty', 'match[password]']]],
52
+						"input1"=>[["inputType"=>"password", "rules"=>['minLength[6]', 'empty']]],
53
+						"input2"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty', 'match[password]']]],
54 54
 						"input3"=>[["rules"=>"email"]],
55 55
 						"submit"=>["green basic"]],
56
-				["login","password","passwordConf","email","submit"],
57
-				["Login","Password","Password confirmation","Email address","Creation"],
58
-				[1,2]);
56
+				["login", "password", "passwordConf", "email", "submit"],
57
+				["Login", "Password", "Password confirmation", "Email address", "Creation"],
58
+				[1, 2]);
59 59
 		$result->addDividerBefore(0, "Creation");
60 60
 		return $result;
61 61
 	}
62 62
 
63
-	public static function attachedSegment($identifier,$modelInstance=null){
64
-		$result=self::regular($identifier,$modelInstance);
65
-		$result->fieldAsMessage("message",["icon"=>"sign in","attached"=>true]);
66
-		$result->addWrapper("message",null,"<div class='ui attached segment'>");
67
-		$result->addWrapper("error", null,"</div>");
63
+	public static function attachedSegment($identifier, $modelInstance=null) {
64
+		$result=self::regular($identifier, $modelInstance);
65
+		$result->fieldAsMessage("message", ["icon"=>"sign in", "attached"=>true]);
66
+		$result->addWrapper("message", null, "<div class='ui attached segment'>");
67
+		$result->addWrapper("error", null, "</div>");
68 68
 		return $result;
69 69
 	}
70 70
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/base/traits/LabeledIconTrait.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 trait LabeledIconTrait {
14 14
 
15 15
 	abstract public function addToProperty($name, $value, $separator=" ");
16
-	abstract public function addContent($content,$before=false);
16
+	abstract public function addContent($content, $before=false);
17 17
 
18 18
 	/**
19 19
 	 * Adds an icon before or after
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
 	 * @param boolean $labeled
23 23
 	 * @return \Ajax\semantic\html\elements\HtmlIcon
24 24
 	 */
25
-	public function addIcon($icon,$before=true,$labeled=false){
25
+	public function addIcon($icon, $before=true, $labeled=false) {
26 26
 		$iconO=$icon;
27
-		if(\is_string($icon)){
27
+		if (\is_string($icon)) {
28 28
 			$iconO=new HtmlIcon("icon-".$this->identifier, $icon);
29 29
 		}
30
-		if($labeled!==false){
31
-			$direction=($before===true)?Direction::LEFT:Direction::RIGHT;
30
+		if ($labeled!==false) {
31
+			$direction=($before===true) ?Direction::LEFT : Direction::RIGHT;
32 32
 			$this->addToProperty("class", $direction." labeled icon");
33 33
 			$this->tagName="div";
34 34
 		}
35
-		$this->addContent($iconO,$before);
35
+		$this->addContent($iconO, $before);
36 36
 		return $iconO;
37 37
 	}
38 38
 }
Please login to merge, or discard this patch.
Ajax/semantic/widgets/datatable/Pagination.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 	private $pages_visibles;
10 10
 	private $row_count;
11 11
 
12
-	public function __construct($items_per_page=10,$pages_visibles=null,$page=1,$row_count=null){
12
+	public function __construct($items_per_page=10, $pages_visibles=null, $page=1, $row_count=null) {
13 13
 		$this->items_per_page=$items_per_page;
14 14
 		$this->row_count=$row_count;
15 15
 		$this->page=$page;
@@ -17,30 +17,30 @@  discard block
 block discarded – undo
17 17
 		$this->visible=true;
18 18
 	}
19 19
 
20
-	public function getObjects($objects){
20
+	public function getObjects($objects) {
21 21
 		$auto=(!isset($this->row_count));
22 22
 		$os=$objects;
23
-		if(!\is_array($os)){
23
+		if (!\is_array($os)) {
24 24
 			$os=[];
25
-			foreach ($objects as $o){
25
+			foreach ($objects as $o) {
26 26
 				$os[]=$o;
27 27
 			}
28 28
 		}
29
-		$this->page_count = 0;
30
-		$row_count=($auto)?\sizeof($os):$this->row_count;
31
-		if (0 === $row_count) {
29
+		$this->page_count=0;
30
+		$row_count=($auto) ?\sizeof($os) : $this->row_count;
31
+		if (0===$row_count) {
32 32
 			$this->visible=false;
33 33
 		} else {
34 34
 
35
-			$this->page_count = (int)ceil($row_count / $this->items_per_page);
35
+			$this->page_count=(int)ceil($row_count/$this->items_per_page);
36 36
 			$this->visible=$this->page_count>1;
37
-			if($this->page > $this->page_count+1) {
38
-				$this->page = 1;
37
+			if ($this->page>$this->page_count+1) {
38
+				$this->page=1;
39 39
 			}
40 40
 		}
41
-		if($auto){
42
-			$offset = ($this->page - 1) * $this->items_per_page;
43
-			return array_slice($os, $offset,$this->items_per_page);
41
+		if ($auto) {
42
+			$offset=($this->page-1)*$this->items_per_page;
43
+			return array_slice($os, $offset, $this->items_per_page);
44 44
 		}
45 45
 		return $os;
46 46
 	}
@@ -76,22 +76,22 @@  discard block
 block discarded – undo
76 76
 		return $this->page_count;
77 77
 	}
78 78
 
79
-	public function getPagesNumbers(){
80
-		$middle= (int)ceil(($this->pages_visibles-1)/ 2);
79
+	public function getPagesNumbers() {
80
+		$middle=(int)ceil(($this->pages_visibles-1)/2);
81 81
 		$first=$this->page-$middle;
82
-		if($first<1){
82
+		if ($first<1) {
83 83
 			$first=1;
84 84
 		}
85 85
 		$last=$first+$this->pages_visibles-1;
86
-		if($last>$this->page_count){
86
+		if ($last>$this->page_count) {
87 87
 			$last=$this->page_count;
88 88
 		}
89 89
 		return \range($first, $last);
90 90
 	}
91 91
 
92 92
 	public function setPagesVisibles($pages_visibles) {
93
-		if(!isset($pages_visibles))
94
-			$pages_visibles=(int)ceil($this->row_count / $this->items_per_page)+1;
93
+		if (!isset($pages_visibles))
94
+			$pages_visibles=(int)ceil($this->row_count/$this->items_per_page)+1;
95 95
 		$this->pages_visibles=$pages_visibles;
96 96
 		return $this;
97 97
 	}
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/InstanceViewer.php 1 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.
Ajax/semantic/components/Modal.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,16 +16,16 @@
 block discarded – undo
16 16
 		return $this;
17 17
 	}
18 18
 
19
-	public function showDimmer(){
19
+	public function showDimmer() {
20 20
 		return $this->setBehavior("hide dimmer");
21 21
 	}
22 22
 
23
-	public function setInverted(){
23
+	public function setInverted() {
24 24
 		$this->params["inverted"]=true;
25 25
 	}
26 26
 
27 27
 	public function setOnHidden($jsCode) {
28
-		$jsCode=str_ireplace("\"","%quote%", $jsCode);
28
+		$jsCode=str_ireplace("\"", "%quote%", $jsCode);
29 29
 		return $this->setParam("onHidden", "%function(){".$jsCode."}%");
30 30
 	}
31 31
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/content/view/HtmlViewItem.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
 abstract class HtmlViewItem extends HtmlSemDoubleElement {
18 18
 	use ContentPartTrait;
19 19
 
20
-	public function __construct($identifier,$baseClass,$content=NULL) {
20
+	public function __construct($identifier, $baseClass, $content=NULL) {
21 21
 		parent::__construct($identifier, "div", $baseClass);
22 22
 		$this->content=["content"=>new HtmlViewContent("content-".$this->identifier)];
23
-		if(isset($content))
23
+		if (isset($content))
24 24
 			$this->setContent($content);
25 25
 	}
26 26
 
27
-	public function setContent($value){
27
+	public function setContent($value) {
28 28
 		if (\is_array($value)) {
29 29
 			$image=JArray::getValue($value, "image", 0);
30 30
 			$content=JArray::getValue($value, "content", 1);
@@ -32,57 +32,57 @@  discard block
 block discarded – undo
32 32
 			if (isset($image)) {
33 33
 				$this->addImage($image);
34 34
 			}
35
-			if(isset($content))
35
+			if (isset($content))
36 36
 				$this->content["content"]->setContent($content);
37
-			if(isset($extra))
37
+			if (isset($extra))
38 38
 				$this->addExtraContent($extra);
39 39
 		}
40 40
 	}
41 41
 
42 42
 	private function createContent($content, $baseClass="content") {
43 43
 		$count=\sizeof($this->content);
44
-		$result=new HtmlViewContent("content-" . $count . "-" . $this->identifier, $content);
44
+		$result=new HtmlViewContent("content-".$count."-".$this->identifier, $content);
45 45
 		$result->setClass($baseClass);
46 46
 		return $result;
47 47
 	}
48 48
 
49 49
 	private function addElementIn($key, $element) {
50
-		if (\array_key_exists($key, $this->content) === false) {
50
+		if (\array_key_exists($key, $this->content)===false) {
51 51
 			$this->content[$key]=[];
52 52
 		}
53
-		if($this->content[$key] instanceof HtmlViewContent)
53
+		if ($this->content[$key] instanceof HtmlViewContent)
54 54
 			$this->content[$key]->addElement($element);
55 55
 		else
56 56
 			$this->content[$key][]=$element;
57 57
 		return $element;
58 58
 	}
59 59
 
60
-	public function addIcon($icon,$before=true){
61
-		return $this->addElementIn("icon",new HtmlIcon("icon-" . $this->identifier, $icon));
60
+	public function addIcon($icon, $before=true) {
61
+		return $this->addElementIn("icon", new HtmlIcon("icon-".$this->identifier, $icon));
62 62
 	}
63 63
 
64 64
 
65 65
 	public function addHeader($header, $niveau=4, $type="page") {
66 66
 		if (!$header instanceof HtmlHeader) {
67
-			$header=new HtmlHeader("header-" . $this->identifier, $niveau, $header, $type);
67
+			$header=new HtmlHeader("header-".$this->identifier, $niveau, $header, $type);
68 68
 		}
69
-		return $this->addElementIn("header",$this->createContent($header));
69
+		return $this->addElementIn("header", $this->createContent($header));
70 70
 	}
71 71
 
72 72
 	public function addImage($image, $title="") {
73 73
 		if (!$image instanceof HtmlImage) {
74
-			$image=new HtmlImage("image-" . $this->identifier, $image, $title);
74
+			$image=new HtmlImage("image-".$this->identifier, $image, $title);
75 75
 		}
76 76
 		$image->setClass("ui image");
77
-		return $this->content["image"]= $image;
77
+		return $this->content["image"]=$image;
78 78
 	}
79 79
 
80
-	public function addReveal($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL,$key="extra-content") {
80
+	public function addReveal($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL, $key="extra-content") {
81 81
 		$reveal=$visibleContent;
82 82
 		if (!$visibleContent instanceof HtmlReveal) {
83
-			$reveal=new HtmlReveal("reveral-" . $this->identifier, $visibleContent, $hiddenContent, $type, $attributeType);
83
+			$reveal=new HtmlReveal("reveral-".$this->identifier, $visibleContent, $hiddenContent, $type, $attributeType);
84 84
 		}
85
-		return $this->content[$key]= $reveal;
85
+		return $this->content[$key]=$reveal;
86 86
 	}
87 87
 
88 88
 	public function addRevealImage($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL) {
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
 		if (!$visibleContent instanceof HtmlReveal) {
91 91
 			return $this->addReveal(new HtmlImage("", $visibleContent), new HtmlImage("", $hiddenContent), $type, $attributeType);
92 92
 		}
93
-		return $this->content["image"]= $reveal;
93
+		return $this->content["image"]=$reveal;
94 94
 	}
95 95
 
96 96
 	public function addExtraContent($content=array()) {
97
-		return $this->content["extra-content"]= $this->createContent($content, "extra content");
97
+		return $this->content["extra-content"]=$this->createContent($content, "extra content");
98 98
 	}
99 99
 
100 100
 	/*public function addContent($content=array(), $before=false) {
@@ -112,23 +112,23 @@  discard block
 block discarded – undo
112 112
 	 * @param boolean $before
113 113
 	 * @return HtmlButtonGroups
114 114
 	 */
115
-	public function addContentButtons($elements=array(), $asIcons=false,$part="extra",$before=false){
116
-		return $this->content["content"]->addContentButtons($elements,$asIcons,$part, $before);
115
+	public function addContentButtons($elements=array(), $asIcons=false, $part="extra", $before=false) {
116
+		return $this->content["content"]->addContentButtons($elements, $asIcons, $part, $before);
117 117
 	}
118 118
 
119 119
 
120 120
 
121
-	public function addItemHeaderContent($header, $metas=array(), $description=NULL,$extra=NULL) {
122
-		return $this->content["content"]->addHeaderContent($header, $metas, $description,$extra);
121
+	public function addItemHeaderContent($header, $metas=array(), $description=NULL, $extra=NULL) {
122
+		return $this->content["content"]->addHeaderContent($header, $metas, $description, $extra);
123 123
 	}
124 124
 
125 125
 	public function addItemContent($content=array()) {
126 126
 		$count=\sizeof($this->content);
127
-		return $this->addElementIn("content", new HtmlViewContent("content-" . $count . "-" . $this->identifier, $content));
127
+		return $this->addElementIn("content", new HtmlViewContent("content-".$count."-".$this->identifier, $content));
128 128
 	}
129 129
 
130 130
 	public function getItemContent() {
131
-		return $this->getPart("content",null,true);
131
+		return $this->getPart("content", null, true);
132 132
 	}
133 133
 
134 134
 	public function getItemExtraContent() {
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
 	 * @see HtmlSemDoubleElement::compile()
151 151
 	 */
152 152
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
153
-		$this->content=JArray::sortAssociative($this->content, ["header","image","icon","content","extra-content"]);
153
+		$this->content=JArray::sortAssociative($this->content, ["header", "image", "icon", "content", "extra-content"]);
154 154
 		return parent::compile($js, $view);
155 155
 	}
156 156
 
157
-	public function asLink($href="",$target=NULL) {
157
+	public function asLink($href="", $target=NULL) {
158 158
 		$this->addToProperty("class", "link");
159
-		if ($href !== "") {
159
+		if ($href!=="") {
160 160
 			$this->setProperty("href", $href);
161 161
 			if (isset($target))
162 162
 				$this->setProperty("target", $target);
Please login to merge, or discard this patch.
Ajax/semantic/html/content/view/HtmlViewGroups.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 abstract class HtmlViewGroups extends HtmlSemCollection {
11 11
 
12
-	public function __construct($identifier, $uiClass,$items=array()) {
12
+	public function __construct($identifier, $uiClass, $items=array()) {
13 13
 		parent::__construct($identifier, "div", $uiClass);
14 14
 		$this->addItems($items);
15 15
 	}
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * @param int $wide
42 42
 	 */
43 43
 	public function setWide($wide) {
44
-		$wide=Wide::getConstants()["W" . $wide];
44
+		$wide=Wide::getConstants()["W".$wide];
45 45
 		return $this->addToPropertyCtrl("class", $wide, Wide::getConstants());
46 46
 	}
47 47
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		return $this->addItem($function($object));
60 60
 	}
61 61
 
62
-	public function run(JsUtils $js){
62
+	public function run(JsUtils $js) {
63 63
 		$result=parent::run($js);
64 64
 		return $result->setItemSelector(".item");
65 65
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/table/traits/TableTrait.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@  discard block
 block discarded – undo
7 7
  * @author jc
8 8
  * @property HtmlTable $_self
9 9
  */
10
-trait TableTrait{
10
+trait TableTrait {
11 11
 
12 12
 	abstract public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false);
13 13
 	abstract public function getOn($event, $url, $responseElement="", $parameters=array());
14 14
 
15
-	protected function addToPropertyTable($property,$value){
15
+	protected function addToPropertyTable($property, $value) {
16 16
 		return $this->_self->addToProperty($property, $value);
17 17
 	}
18 18
 
@@ -23,15 +23,15 @@  discard block
 block discarded – undo
23 23
 	public function setBasic($very=false) {
24 24
 		$table=$this->_self;
25 25
 		if ($very)
26
-			$table->addToPropertyCtrl("class", "very", array ("very" ));
27
-		return $table->addToPropertyCtrl("class", "basic", array ("basic" ));
26
+			$table->addToPropertyCtrl("class", "very", array("very"));
27
+		return $table->addToPropertyCtrl("class", "basic", array("basic"));
28 28
 	}
29 29
 
30 30
 	public function setCompact($very=false) {
31 31
 		$table=$this->_self;
32 32
 		if ($very)
33
-			$table->addToPropertyCtrl("class", "very", array ("very" ));
34
-		return $table->addToPropertyCtrl("class", "compact", array ("compact" ));
33
+			$table->addToPropertyCtrl("class", "very", array("very"));
34
+		return $table->addToPropertyCtrl("class", "compact", array("compact"));
35 35
 	}
36 36
 
37 37
 	public function setCollapsing() {
@@ -70,16 +70,16 @@  discard block
 block discarded – undo
70 70
 		return $this->addToPropertyTable("class", "striped");
71 71
 	}
72 72
 
73
-	public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false){
74
-		return $this->onRow("click", $jsCode,$stopPropagation,$preventDefault);
73
+	public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false) {
74
+		return $this->onRow("click", $jsCode, $stopPropagation, $preventDefault);
75 75
 	}
76 76
 
77
-	public function onRow($event,$jsCode, $stopPropagation=false, $preventDefault=false){
78
-		return $this->_self->addEvent($event."{{tr}}",$jsCode,$stopPropagation,$preventDefault);
77
+	public function onRow($event, $jsCode, $stopPropagation=false, $preventDefault=false) {
78
+		return $this->_self->addEvent($event."{{tr}}", $jsCode, $stopPropagation, $preventDefault);
79 79
 	}
80 80
 
81
-	public function getOnRow($event, $url, $responseElement="", $parameters=array()){
82
-		$parameters=\array_merge($parameters,["stopPropagation"=>false,"preventDefault"=>false]);
83
-		return $this->_self->getOn($event."{{tbody tr}}", $url,$responseElement,$parameters);
81
+	public function getOnRow($event, $url, $responseElement="", $parameters=array()) {
82
+		$parameters=\array_merge($parameters, ["stopPropagation"=>false, "preventDefault"=>false]);
83
+		return $this->_self->getOn($event."{{tbody tr}}", $url, $responseElement, $parameters);
84 84
 	}
85 85
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/content/table/HtmlTR.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -20,19 +20,19 @@  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
 		}
32 32
 		return $this;
33 33
 	}
34 34
 
35
-	public function getColCount(){
35
+	public function getColCount() {
36 36
 		return $this->count();
37 37
 	}
38 38
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @param mixed $values
69 69
 	 */
70 70
 	public function setValues($values=array()) {
71
-		return $this->_addOrSetValues($values, function(HtmlTD &$cell,$value){$cell->setValue($value);});
71
+		return $this->_addOrSetValues($values, function(HtmlTD&$cell, $value) {$cell->setValue($value); });
72 72
 	}
73 73
 
74 74
 	/**
@@ -76,27 +76,27 @@  discard block
 block discarded – undo
76 76
 	 * @param mixed $values
77 77
 	 */
78 78
 	public function addValues($values=array()) {
79
-		return $this->_addOrSetValues($values, function(HtmlTD &$cell,$value){$cell->addValue($value);});
79
+		return $this->_addOrSetValues($values, function(HtmlTD&$cell, $value) {$cell->addValue($value); });
80 80
 	}
81 81
 
82 82
 	/**
83 83
 	 * Sets or adds values to the row cols
84 84
 	 * @param mixed $values
85 85
 	 */
86
-	protected function _addOrSetValues($values,$callback) {
86
+	protected function _addOrSetValues($values, $callback) {
87 87
 		$count=$this->count();
88 88
 		if (!\is_array($values)) {
89 89
 			$values=\array_fill(0, $count, $values);
90 90
 		} else {
91
-			if (JArray::isAssociative($values) === true) {
91
+			if (JArray::isAssociative($values)===true) {
92 92
 				$values=\array_values($values);
93 93
 			}
94 94
 		}
95 95
 		$count=\min(\sizeof($values), $count);
96 96
 
97
-		for($i=0; $i < $count; $i++) {
97
+		for ($i=0; $i<$count; $i++) {
98 98
 			$cell=$this->content[$i];
99
-			$callback($cell,$values[$i]);
99
+			$callback($cell, $values[$i]);
100 100
 		}
101 101
 		return $this;
102 102
 	}
@@ -122,20 +122,20 @@  discard block
 block discarded – undo
122 122
 	public function getColPosition($colIndex) {
123 123
 		$pos=0;
124 124
 		$rows=$this->_container->getContent();
125
-		for($i=0; $i < $this->_row; $i++) {
125
+		for ($i=0; $i<$this->_row; $i++) {
126 126
 			$max=\min($colIndex, $rows[$i]->count());
127
-			for($j=0; $j < $max; $j++) {
127
+			for ($j=0; $j<$max; $j++) {
128 128
 				$rowspan=$rows[$i]->getItem($j)->getRowspan();
129
-				if ($rowspan + $i > $this->_row)
129
+				if ($rowspan+$i>$this->_row)
130 130
 					$pos++;
131 131
 			}
132 132
 		}
133
-		if ($pos > $colIndex)
133
+		if ($pos>$colIndex)
134 134
 			return NULL;
135 135
 		$count=$this->count();
136
-		for($i=0; $i < $count; $i++) {
136
+		for ($i=0; $i<$count; $i++) {
137 137
 			$pos+=$this->content[$i]->getColspan();
138
-			if ($pos >= $colIndex + 1)
138
+			if ($pos>=$colIndex+1)
139 139
 				return $i;
140 140
 		}
141 141
 		return null;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
 	public function conditionalCellFormat($callback, $format) {
145 145
 		$cells=$this->content;
146
-		foreach ( $cells as $cell ) {
146
+		foreach ($cells as $cell) {
147 147
 			$cell->conditionalCellFormat($callback, $format);
148 148
 		}
149 149
 		return $this;
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 
159 159
 	public function containsStr($needle) {
160 160
 		$cells=$this->content;
161
-		foreach ( $cells as $cell ) {
162
-			if (\strpos($cell->getContent(), $needle) !== false)
161
+		foreach ($cells as $cell) {
162
+			if (\strpos($cell->getContent(), $needle)!==false)
163 163
 				return true;
164 164
 		}
165 165
 		return false;
@@ -172,13 +172,13 @@  discard block
 block discarded – undo
172 172
 
173 173
 	public function applyCells($callback) {
174 174
 		$cells=$this->content;
175
-		foreach ( $cells as $cell ) {
175
+		foreach ($cells as $cell) {
176 176
 			$cell->apply($callback);
177 177
 		}
178 178
 		return $this;
179 179
 	}
180 180
 
181
-	public function toDelete($colIndex){
181
+	public function toDelete($colIndex) {
182 182
 		$this->getItem($colIndex)->toDelete();
183 183
 		return $this;
184 184
 	}
Please login to merge, or discard this patch.