Completed
Push — master ( 667888...aa0ebb )
by Jean-Christophe
03:27
created
Ajax/semantic/widgets/dataform/DataForm.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,8 +49,9 @@
 block discarded – undo
49 49
 			$fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]);
50 50
 			if(\sizeof($fields)===1){
51 51
 				$form->addField($fields[0]);
52
-			}else
53
-				$form->addFields($fields);
52
+			} else {
53
+							$form->addFields($fields);
54
+			}
54 55
 		}
55 56
 	}
56 57
 
Please login to merge, or discard this patch.
Ajax/semantic/widgets/dataform/FormInstanceViewer.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,17 +34,18 @@
 block discarded – undo
34 34
 		$property=$this->getProperty($index);
35 35
 		if($property instanceof \ReflectionProperty){
36 36
 			$result=$property->getName();
37
-		}elseif(\is_callable($property)){
37
+		} elseif(\is_callable($property)){
38 38
 			$result=$this->visibleProperties[$index];
39
-		}else{
39
+		} else{
40 40
 			$result=\strtolower($this->getCaption($index));
41 41
 		}
42 42
 		return $result;
43 43
 	}
44 44
 
45 45
 	public function addSeparatorAfter($fieldNum){
46
-		if(\array_search($fieldNum, $this->separators)===false)
47
-			$this->separators[]=$fieldNum;
46
+		if(\array_search($fieldNum, $this->separators)===false) {
47
+					$this->separators[]=$fieldNum;
48
+		}
48 49
 			return $this;
49 50
 	}
50 51
 
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/InstanceViewer.php 1 patch
Braces   +33 added lines, -28 removed lines patch added patch discarded remove patch
@@ -17,8 +17,9 @@  discard block
 block discarded – undo
17 17
 	public function __construct($instance=NULL,$captions=NULL){
18 18
 		$this->values=[];
19 19
 		$this->afterCompile=[];
20
-		if(isset($instance))
21
-			$this->setInstance($instance);
20
+		if(isset($instance)) {
21
+					$this->setInstance($instance);
22
+		}
22 23
 		$this->setCaptions($captions);
23 24
 	}
24 25
 
@@ -34,8 +35,9 @@  discard block
 block discarded – undo
34 35
 
35 36
 	public function getIdentifier(){
36 37
 		$value=self::$index;
37
-		if(isset($this->values["identifier"]))
38
-			$value=$this->values["identifier"](self::$index,$this->instance);
38
+		if(isset($this->values["identifier"])) {
39
+					$value=$this->values["identifier"](self::$index,$this->instance);
40
+		}
39 41
 		return $value;
40 42
 	}
41 43
 
@@ -58,17 +60,18 @@  discard block
 block discarded – undo
58 60
 			$value=$property->getValue($this->instance);
59 61
 			if(isset($this->values[$index])){
60 62
 				$value= $this->values[$index]($value,$this->instance,$index);
61
-			}else{
63
+			} else{
62 64
 				$value=$this->_getDefaultValue($property->getName(),$value, $index);
63 65
 			}
64
-		}else{
65
-			if(\is_callable($property))
66
-				$value=$property($this->instance);
67
-			elseif(\is_array($property)){
66
+		} else{
67
+			if(\is_callable($property)) {
68
+							$value=$property($this->instance);
69
+			} elseif(\is_array($property)){
68 70
 				$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property);
69 71
 				$value=\implode("", $values);
70
-			}else
71
-				$value=$property;
72
+			} else {
73
+							$value=$property;
74
+			}
72 75
 		}
73 76
 		if(isset($this->afterCompile[$index])){
74 77
 			if(\is_callable($this->afterCompile[$index])){
@@ -88,10 +91,10 @@  discard block
 block discarded – undo
88 91
 		if(isset($vb[$index])){
89 92
 			if(\is_array($vb[$index])){
90 93
 				$this->visibleProperties[$index][]=$field;
91
-			}else{
94
+			} else{
92 95
 				$this->visibleProperties[$index]=[$vb[$index],$field];
93 96
 			}
94
-		}else{
97
+		} else{
95 98
 			return $this->insertField($index, $field);
96 99
 		}
97 100
 		return $this;
@@ -127,26 +130,27 @@  discard block
 block discarded – undo
127 130
 		$this->reflect=new \ReflectionClass($instance);
128 131
 		if(\sizeof($this->visibleProperties)===0){
129 132
 			$this->properties=$this->getDefaultProperties();
130
-		}else{
133
+		} else{
131 134
 			foreach ($this->visibleProperties as $property){
132 135
 				if(\is_callable($property)){
133 136
 					$this->properties[]=$property;
134
-				}elseif(\is_string($property)){
137
+				} elseif(\is_string($property)){
135 138
 					try{
136 139
 						$this->_beforeAddProperty(\sizeof($this->properties), $property);
137 140
 						$rProperty=$this->reflect->getProperty($property);
138 141
 						$this->properties[]=$rProperty;
139
-					}catch(\Exception $e){
142
+					} catch(\Exception $e){
140 143
 						$this->_beforeAddProperty(\sizeof($this->properties), $property);
141 144
 						$this->properties[]=$property;
142 145
 					}
143
-				}elseif(\is_int($property)){
146
+				} elseif(\is_int($property)){
144 147
 					$props=$this->getDefaultProperties();
145
-					if(isset($props[$property]))
146
-						$this->properties[]=$props[$property];
147
-					else
148
-						$this->properties[]=$property;
149
-				}else{
148
+					if(isset($props[$property])) {
149
+											$this->properties[]=$props[$property];
150
+					} else {
151
+											$this->properties[]=$property;
152
+					}
153
+				} else{
150 154
 					$this->properties[]=$property;
151 155
 				}
152 156
 			}
@@ -190,12 +194,13 @@  discard block
 block discarded – undo
190 194
 	}
191 195
 
192 196
 	public function getCaption($index){
193
-		if($this->properties[$index] instanceof \ReflectionProperty)
194
-			return $this->properties[$index]->getName();
195
-			elseif(\is_callable($this->properties[$index]))
196
-			return "";
197
-			else
198
-				return $this->properties[$index];
197
+		if($this->properties[$index] instanceof \ReflectionProperty) {
198
+					return $this->properties[$index]->getName();
199
+		} elseif(\is_callable($this->properties[$index])) {
200
+						return "";
201
+			} else {
202
+							return $this->properties[$index];
203
+			}
199 204
 	}
200 205
 
201 206
 	public function getCaptions(){
Please login to merge, or discard this patch.
Ajax/semantic/widgets/dataform/FormFieldAsTrait.php 1 patch
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,10 +43,11 @@  discard block
 block discarded – undo
43 43
 	protected function _addRules($element,$attributes){
44 44
 		if(isset($attributes["rules"])){
45 45
 			$rules=$attributes["rules"];
46
-			if(\is_array($rules))
47
-				$element->addRules($rules);
48
-				else
49
-					$element->addRule($rules);
46
+			if(\is_array($rules)) {
47
+							$element->addRules($rules);
48
+			} else {
49
+									$element->addRule($rules);
50
+				}
50 51
 				unset($attributes["rules"]);
51 52
 		}
52 53
 	}
@@ -56,8 +57,9 @@  discard block
 block discarded – undo
56 57
 			$caption=$this->_instanceViewer->getCaption($index);
57 58
 			$name=$this->_instanceViewer->getFieldName($index);
58 59
 			$element=$elementCallback($name,$caption,$value);
59
-			if(\is_array($attributes))
60
-				$this->_applyAttributes($element, $attributes,$index);
60
+			if(\is_array($attributes)) {
61
+							$this->_applyAttributes($element, $attributes,$index);
62
+			}
61 63
 			return $element;
62 64
 		});
63 65
 			return $this;
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/FieldAsTrait.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,8 +34,9 @@  discard block
 block discarded – undo
34 34
 				$name=$attributes["name"];
35 35
 			}
36 36
 			$element=$elementCallback($this->_getFieldIdentifier($prefix),$value,$name);
37
-			if(\is_array($attributes))
38
-				$this->_applyAttributes($element, $attributes,$index);
37
+			if(\is_array($attributes)) {
38
+							$this->_applyAttributes($element, $attributes,$index);
39
+			}
39 40
 			return $element;
40 41
 		});
41 42
 			return $this;
@@ -68,7 +69,9 @@  discard block
 block discarded – undo
68 69
 
69 70
 	public function fieldAsImage($index,$size=Size::SMALL,$circular=false){
70 71
 		$this->setValueFunction($index,function($img) use($size,$circular){
71
-			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular();
72
+			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular) {
73
+				$image->setCircular();
74
+			}
72 75
 			return $image;
73 76
 		});
74 77
 			return $this;
Please login to merge, or discard this patch.