@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | public function onCreate($jsCode){ |
53 | 53 | if(isset($this->_events["_create"])){ |
54 | 54 | $this->_events["_create"][]=$jsCode; |
55 | - }else{ |
|
55 | + } else{ |
|
56 | 56 | $this->_events["_create"]=[$jsCode]; |
57 | 57 | } |
58 | 58 | return $this; |
@@ -87,8 +87,9 @@ discard block |
||
87 | 87 | if(\is_array($create)){ |
88 | 88 | $create=\implode("", $create); |
89 | 89 | } |
90 | - if(isset($js) && $create!=="") |
|
91 | - $js->exec($create,true); |
|
90 | + if(isset($js) && $create!=="") { |
|
91 | + $js->exec($create,true); |
|
92 | + } |
|
92 | 93 | unset($this->_events["_create"]); |
93 | 94 | } |
94 | 95 | } |
@@ -20,8 +20,9 @@ discard block |
||
20 | 20 | $this->widgetIdentifier=$identifier; |
21 | 21 | $this->values=[]; |
22 | 22 | $this->afterCompile=[]; |
23 | - if(isset($instance)) |
|
24 | - $this->setInstance($instance); |
|
23 | + if(isset($instance)) { |
|
24 | + $this->setInstance($instance); |
|
25 | + } |
|
25 | 26 | $this->setCaptions($captions); |
26 | 27 | $this->captionCallback=NULL; |
27 | 28 | } |
@@ -38,8 +39,9 @@ discard block |
||
38 | 39 | |
39 | 40 | public function getIdentifier(){ |
40 | 41 | $value=self::$index; |
41 | - if(isset($this->values["identifier"])) |
|
42 | - $value=$this->values["identifier"](self::$index,$this->instance); |
|
42 | + if(isset($this->values["identifier"])) { |
|
43 | + $value=$this->values["identifier"](self::$index,$this->instance); |
|
44 | + } |
|
43 | 45 | return $value; |
44 | 46 | } |
45 | 47 | |
@@ -62,19 +64,19 @@ discard block |
||
62 | 64 | $value=$property->getValue($this->instance); |
63 | 65 | if(isset($this->values[$index])){ |
64 | 66 | $value= $this->values[$index]($value,$this->instance,$index); |
65 | - }else{ |
|
67 | + } else{ |
|
66 | 68 | $value=$this->_getDefaultValue($property->getName(),$value, $index); |
67 | 69 | } |
68 | - }else{ |
|
69 | - if(\is_callable($property)) |
|
70 | - $value=$property($this->instance); |
|
71 | - elseif(\is_array($property)){ |
|
70 | + } else{ |
|
71 | + if(\is_callable($property)) { |
|
72 | + $value=$property($this->instance); |
|
73 | + } elseif(\is_array($property)){ |
|
72 | 74 | $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property); |
73 | 75 | $value=\implode("", $values); |
74 | - }else{ |
|
76 | + } else{ |
|
75 | 77 | if(isset($this->values[$index])){ |
76 | 78 | $value= $this->values[$index]($property,$this->instance,$index); |
77 | - }else{ |
|
79 | + } else{ |
|
78 | 80 | $value=$property; |
79 | 81 | } |
80 | 82 | } |
@@ -97,10 +99,10 @@ discard block |
||
97 | 99 | if(isset($vb[$index])){ |
98 | 100 | if(\is_array($vb[$index])){ |
99 | 101 | $this->visibleProperties[$index][]=$field; |
100 | - }else{ |
|
102 | + } else{ |
|
101 | 103 | $this->visibleProperties[$index]=[$vb[$index],$field]; |
102 | 104 | } |
103 | - }else{ |
|
105 | + } else{ |
|
104 | 106 | return $this->insertField($index, $field); |
105 | 107 | } |
106 | 108 | return $this; |
@@ -136,7 +138,7 @@ discard block |
||
136 | 138 | $this->reflect=new \ReflectionClass($instance); |
137 | 139 | if(\sizeof($this->visibleProperties)===0){ |
138 | 140 | $this->properties=$this->getDefaultProperties(); |
139 | - }else{ |
|
141 | + } else{ |
|
140 | 142 | foreach ($this->visibleProperties as $property){ |
141 | 143 | $this->setInstanceProperty($property); |
142 | 144 | } |
@@ -147,22 +149,23 @@ discard block |
||
147 | 149 | private function setInstanceProperty($property){ |
148 | 150 | if(\is_callable($property)){ |
149 | 151 | $this->properties[]=$property; |
150 | - }elseif(\is_string($property)){ |
|
152 | + } elseif(\is_string($property)){ |
|
151 | 153 | try{ |
152 | 154 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
153 | 155 | $rProperty=$this->reflect->getProperty($property); |
154 | 156 | $this->properties[]=$rProperty; |
155 | - }catch(\Exception $e){ |
|
157 | + } catch(\Exception $e){ |
|
156 | 158 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
157 | 159 | $this->properties[]=$property; |
158 | 160 | } |
159 | - }elseif(\is_int($property)){ |
|
161 | + } elseif(\is_int($property)){ |
|
160 | 162 | $props=$this->getDefaultProperties(); |
161 | - if(isset($props[$property])) |
|
162 | - $this->properties[]=$props[$property]; |
|
163 | - else |
|
164 | - $this->properties[]=$property; |
|
165 | - }else{ |
|
163 | + if(isset($props[$property])) { |
|
164 | + $this->properties[]=$props[$property]; |
|
165 | + } else { |
|
166 | + $this->properties[]=$property; |
|
167 | + } |
|
168 | + } else{ |
|
166 | 169 | $this->properties[]=$property; |
167 | 170 | } |
168 | 171 | } |
@@ -206,12 +209,13 @@ discard block |
||
206 | 209 | if(isset($this->captions[$index])){ |
207 | 210 | return $this->captions[$index]; |
208 | 211 | } |
209 | - if($this->properties[$index] instanceof \ReflectionProperty) |
|
210 | - return $this->properties[$index]->getName(); |
|
211 | - elseif(\is_callable($this->properties[$index])) |
|
212 | - return ""; |
|
213 | - else |
|
214 | - return $this->properties[$index]; |
|
212 | + if($this->properties[$index] instanceof \ReflectionProperty) { |
|
213 | + return $this->properties[$index]->getName(); |
|
214 | + } elseif(\is_callable($this->properties[$index])) { |
|
215 | + return ""; |
|
216 | + } else { |
|
217 | + return $this->properties[$index]; |
|
218 | + } |
|
215 | 219 | } |
216 | 220 | |
217 | 221 | public function getCaptions(){ |
@@ -220,7 +224,7 @@ discard block |
||
220 | 224 | for($i=\sizeof($captions);$i<$this->count();$i++){ |
221 | 225 | $captions[]=""; |
222 | 226 | } |
223 | - }else{ |
|
227 | + } else{ |
|
224 | 228 | $captions=[]; |
225 | 229 | $index=0; |
226 | 230 | $count=$this->count(); |
@@ -236,8 +240,9 @@ discard block |
||
236 | 240 | } |
237 | 241 | |
238 | 242 | public function setCaption($index,$caption){ |
239 | - if(isset($this->captions)===false) |
|
240 | - $this->captions=[]; |
|
243 | + if(isset($this->captions)===false) { |
|
244 | + $this->captions=[]; |
|
245 | + } |
|
241 | 246 | $this->captions[$index]=$caption; |
242 | 247 | return $this; |
243 | 248 | } |