Completed
Push — master ( 5ec30c...b92773 )
by Jean-Christophe
03:32
created
Ajax/semantic/widgets/datatable/InstanceViewer.php 1 patch
Braces   +30 added lines, -25 removed lines patch added patch discarded remove patch
@@ -15,16 +15,18 @@  discard block
 block discarded – undo
15 15
 	public function __construct($instance=NULL,$captions=NULL){
16 16
 		$this->values=[];
17 17
 		$this->afterCompile=[];
18
-		if(isset($instance))
19
-			$this->setInstance($instance);
18
+		if(isset($instance)) {
19
+					$this->setInstance($instance);
20
+		}
20 21
 		$this->setCaptions($captions);
21 22
 	}
22 23
 
23 24
 	public function getCaption($index){
24
-		if($this->properties[$index] instanceof \ReflectionProperty)
25
-			return $this->properties[$index]->getName();
26
-		else
27
-			return $this->properties[$index];
25
+		if($this->properties[$index] instanceof \ReflectionProperty) {
26
+					return $this->properties[$index]->getName();
27
+		} else {
28
+					return $this->properties[$index];
29
+		}
28 30
 	}
29 31
 
30 32
 	public function getCaptions(){
@@ -56,8 +58,9 @@  discard block
 block discarded – undo
56 58
 
57 59
 	public function getIdentifier(){
58 60
 		$value=self::$index;
59
-		if(isset($this->values["identifier"]))
60
-			$value=$this->values["identifier"](self::$index,$this->instance);
61
+		if(isset($this->values["identifier"])) {
62
+					$value=$this->values["identifier"](self::$index,$this->instance);
63
+		}
61 64
 		self::$index++;
62 65
 		return $value;
63 66
 	}
@@ -74,14 +77,15 @@  discard block
 block discarded – undo
74 77
 			if(isset($this->values[$index])){
75 78
 				$value= $this->values[$index]($value);
76 79
 			}
77
-		}else{
78
-			if(\is_callable($property))
79
-				$value=$property($this->instance);
80
-			elseif(\is_array($property)){
80
+		} else{
81
+			if(\is_callable($property)) {
82
+							$value=$property($this->instance);
83
+			} elseif(\is_array($property)){
81 84
 				$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property);
82 85
 				$value=\implode("", $values);
83
-			}else
84
-				$value=$property;
86
+			} else {
87
+							$value=$property;
88
+			}
85 89
 		}
86 90
 		if(isset($this->afterCompile[$index])){
87 91
 			if(\is_callable($this->afterCompile[$index])){
@@ -101,10 +105,10 @@  discard block
 block discarded – undo
101 105
 		if(isset($vb[$index])){
102 106
 			if(\is_array($vb[$index])){
103 107
 				$this->visibleProperties[$index][]=$field;
104
-			}else{
108
+			} else{
105 109
 				$this->visibleProperties[$index]=[$vb[$index],$field];
106 110
 			}
107
-		}else{
111
+		} else{
108 112
 			return $this->insertField($index, $field);
109 113
 		}
110 114
 		return $this;
@@ -136,24 +140,25 @@  discard block
 block discarded – undo
136 140
 		$this->reflect=new \ReflectionClass($instance);
137 141
 		if(\sizeof($this->visibleProperties)===0){
138 142
 			$this->properties=$this->getDefaultProperties();
139
-		}else{
143
+		} else{
140 144
 			foreach ($this->visibleProperties as $property){
141 145
 				if(\is_callable($property)){
142 146
 					$this->properties[]=$property;
143
-				}elseif(\is_string($property)){
147
+				} elseif(\is_string($property)){
144 148
 					try{
145 149
 						$rProperty=$this->reflect->getProperty($property);
146 150
 						$this->properties[]=$rProperty;
147
-					}catch(\Exception $e){
151
+					} catch(\Exception $e){
148 152
 						$this->properties[]=$property;
149 153
 					}
150
-				}elseif(\is_int($property)){
154
+				} elseif(\is_int($property)){
151 155
 					$props=$this->getDefaultProperties();
152
-					if(isset($props[$property]))
153
-						$this->properties[]=$props[$property];
154
-					else
155
-						$this->properties[]=$property;
156
-				}else{
156
+					if(isset($props[$property])) {
157
+											$this->properties[]=$props[$property];
158
+					} else {
159
+											$this->properties[]=$property;
160
+					}
161
+				} else{
157 162
 					$this->properties[]=$property;
158 163
 				}
159 164
 			}
Please login to merge, or discard this patch.