@@ -47,8 +47,9 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function addHeader($title, $niveau=1, $dividing=true) { |
49 | 49 | $header=new HtmlHeader("", $niveau, $title); |
50 | - if ($dividing) |
|
51 | - $header->setDividing(); |
|
50 | + if ($dividing) { |
|
51 | + $header->setDividing(); |
|
52 | + } |
|
52 | 53 | return $this->addItem($header); |
53 | 54 | } |
54 | 55 | |
@@ -69,14 +70,16 @@ discard block |
||
69 | 70 | if (\is_string($end)) { |
70 | 71 | $label=$end; |
71 | 72 | \array_pop($fields); |
72 | - } else |
|
73 | - $label=NULL; |
|
73 | + } else { |
|
74 | + $label=NULL; |
|
75 | + } |
|
74 | 76 | } |
75 | 77 | $this->_fields=\array_merge($this->_fields, $fields); |
76 | 78 | $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields); |
77 | 79 | } |
78 | - if (isset($label)) |
|
79 | - $fields=new HtmlFormField("", $fields, $label); |
|
80 | + if (isset($label)) { |
|
81 | + $fields=new HtmlFormField("", $fields, $label); |
|
82 | + } |
|
80 | 83 | } else { |
81 | 84 | $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count()); |
82 | 85 | } |
@@ -145,12 +148,15 @@ discard block |
||
145 | 148 | */ |
146 | 149 | public function addMessage($identifier, $content, $header=NULL, $icon=NULL, $type=NULL) { |
147 | 150 | $message=new HtmlMessage($identifier, $content); |
148 | - if (isset($header)) |
|
149 | - $message->addHeader($header); |
|
150 | - if (isset($icon)) |
|
151 | - $message->setIcon($icon); |
|
152 | - if (isset($type)) |
|
153 | - $message->setStyle($type); |
|
151 | + if (isset($header)) { |
|
152 | + $message->addHeader($header); |
|
153 | + } |
|
154 | + if (isset($icon)) { |
|
155 | + $message->setIcon($icon); |
|
156 | + } |
|
157 | + if (isset($type)) { |
|
158 | + $message->setStyle($type); |
|
159 | + } |
|
154 | 160 | return $this->addItem($message); |
155 | 161 | } |
156 | 162 | |
@@ -169,15 +175,17 @@ discard block |
||
169 | 175 | public function run(JsUtils $js) { |
170 | 176 | $compo=NULL; |
171 | 177 | foreach ($this->_fields as $field){ |
172 | - if($field instanceof HtmlFormField) |
|
173 | - $compo=$this->addCompoValidation($js, $compo, $field); |
|
178 | + if($field instanceof HtmlFormField) { |
|
179 | + $compo=$this->addCompoValidation($js, $compo, $field); |
|
180 | + } |
|
174 | 181 | } |
175 | 182 | foreach ($this->content as $field){ |
176 | 183 | if($field instanceof HtmlFormFields){ |
177 | 184 | $items=$field->getItems(); |
178 | 185 | foreach ($items as $_field){ |
179 | - if($_field instanceof HtmlFormField) |
|
180 | - $compo=$this->addCompoValidation($js, $compo, $_field); |
|
186 | + if($_field instanceof HtmlFormField) { |
|
187 | + $compo=$this->addCompoValidation($js, $compo, $_field); |
|
188 | + } |
|
181 | 189 | } |
182 | 190 | } |
183 | 191 | } |
@@ -17,8 +17,9 @@ discard block |
||
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 |
||
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,19 +60,19 @@ discard block |
||
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{ |
|
72 | + } else{ |
|
71 | 73 | if(isset($this->values[$index])){ |
72 | 74 | $value= $this->values[$index]($property,$this->instance,$index); |
73 | - }else{ |
|
75 | + } else{ |
|
74 | 76 | $value=$property; |
75 | 77 | } |
76 | 78 | } |
@@ -93,10 +95,10 @@ discard block |
||
93 | 95 | if(isset($vb[$index])){ |
94 | 96 | if(\is_array($vb[$index])){ |
95 | 97 | $this->visibleProperties[$index][]=$field; |
96 | - }else{ |
|
98 | + } else{ |
|
97 | 99 | $this->visibleProperties[$index]=[$vb[$index],$field]; |
98 | 100 | } |
99 | - }else{ |
|
101 | + } else{ |
|
100 | 102 | return $this->insertField($index, $field); |
101 | 103 | } |
102 | 104 | return $this; |
@@ -132,26 +134,27 @@ discard block |
||
132 | 134 | $this->reflect=new \ReflectionClass($instance); |
133 | 135 | if(\sizeof($this->visibleProperties)===0){ |
134 | 136 | $this->properties=$this->getDefaultProperties(); |
135 | - }else{ |
|
137 | + } else{ |
|
136 | 138 | foreach ($this->visibleProperties as $property){ |
137 | 139 | if(\is_callable($property)){ |
138 | 140 | $this->properties[]=$property; |
139 | - }elseif(\is_string($property)){ |
|
141 | + } elseif(\is_string($property)){ |
|
140 | 142 | try{ |
141 | 143 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
142 | 144 | $rProperty=$this->reflect->getProperty($property); |
143 | 145 | $this->properties[]=$rProperty; |
144 | - }catch(\Exception $e){ |
|
146 | + } catch(\Exception $e){ |
|
145 | 147 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
146 | 148 | $this->properties[]=$property; |
147 | 149 | } |
148 | - }elseif(\is_int($property)){ |
|
150 | + } elseif(\is_int($property)){ |
|
149 | 151 | $props=$this->getDefaultProperties(); |
150 | - if(isset($props[$property])) |
|
151 | - $this->properties[]=$props[$property]; |
|
152 | - else |
|
153 | - $this->properties[]=$property; |
|
154 | - }else{ |
|
152 | + if(isset($props[$property])) { |
|
153 | + $this->properties[]=$props[$property]; |
|
154 | + } else { |
|
155 | + $this->properties[]=$property; |
|
156 | + } |
|
157 | + } else{ |
|
155 | 158 | $this->properties[]=$property; |
156 | 159 | } |
157 | 160 | } |
@@ -195,12 +198,13 @@ discard block |
||
195 | 198 | } |
196 | 199 | |
197 | 200 | public function getCaption($index){ |
198 | - if($this->properties[$index] instanceof \ReflectionProperty) |
|
199 | - return $this->properties[$index]->getName(); |
|
200 | - elseif(\is_callable($this->properties[$index])) |
|
201 | - return ""; |
|
202 | - else |
|
203 | - return $this->properties[$index]; |
|
201 | + if($this->properties[$index] instanceof \ReflectionProperty) { |
|
202 | + return $this->properties[$index]->getName(); |
|
203 | + } elseif(\is_callable($this->properties[$index])) { |
|
204 | + return ""; |
|
205 | + } else { |
|
206 | + return $this->properties[$index]; |
|
207 | + } |
|
204 | 208 | } |
205 | 209 | |
206 | 210 | public function getCaptions(){ |