@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | { |
62 | 62 | $instance = new static(); |
63 | 63 | $instance->setTagFromMethod( $method ); |
64 | - call_user_func_array( [$instance, 'normalize'], $args += ['',''] ); |
|
64 | + call_user_func_array( [$instance, 'normalize'], $args += ['', ''] ); |
|
65 | 65 | $tags = array_merge( static::TAGS_FORM, static::TAGS_STRUCTURE, static::TAGS_TEXT ); |
66 | 66 | $generatedTag = in_array( $instance->tag, $tags ) |
67 | 67 | ? $instance->buildTag() |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | 'render' => 'is_bool', |
86 | 86 | 'tag' => 'is_string', |
87 | 87 | ]; |
88 | - if( !isset( $properties[$property] ) |
|
89 | - || empty( array_filter( [$value], $properties[$property] )) |
|
88 | + if( !isset($properties[$property]) |
|
89 | + || empty(array_filter( [$value], $properties[$property] )) |
|
90 | 90 | )return; |
91 | 91 | $this->$property = $value; |
92 | 92 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function getOpeningTag() |
106 | 106 | { |
107 | - $attributes = glsr( Attributes::class )->{$this->tag}( $this->args )->toString(); |
|
107 | + $attributes = glsr( Attributes::class )->{$this->tag}($this->args)->toString(); |
|
108 | 108 | return '<'.trim( $this->tag.' '.$attributes ).'>'; |
109 | 109 | } |
110 | 110 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | protected function buildCustomField() |
115 | 115 | { |
116 | 116 | $className = glsr( Helper::class )->buildClassName( $this->tag, __NAMESPACE__.'\Fields' ); |
117 | - if( !class_exists( $className )) { |
|
117 | + if( !class_exists( $className ) ) { |
|
118 | 118 | glsr_log()->error( 'Field missing: '.$className ); |
119 | 119 | return; |
120 | 120 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | protected function buildDefaultTag( $text = '' ) |
128 | 128 | { |
129 | - if( empty( $text )) { |
|
129 | + if( empty($text) ) { |
|
130 | 130 | $text = $this->args['text']; |
131 | 131 | } |
132 | 132 | return $this->getOpeningTag().$text.$this->getClosingTag(); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | protected function buildFieldDescription() |
139 | 139 | { |
140 | - if( !empty( $this->args['description'] )) { |
|
140 | + if( !empty($this->args['description']) ) { |
|
141 | 141 | return $this->small( $this->args['description'] ); |
142 | 142 | } |
143 | 143 | } |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | */ |
148 | 148 | protected function buildFormInput() |
149 | 149 | { |
150 | - if( !in_array( $this->args['type'], ['checkbox', 'radio'] )) { |
|
150 | + if( !in_array( $this->args['type'], ['checkbox', 'radio'] ) ) { |
|
151 | 151 | return $this->buildFormLabel().$this->getOpeningTag(); |
152 | 152 | } |
153 | - return empty( $this->args['options'] ) |
|
153 | + return empty($this->args['options']) |
|
154 | 154 | ? $this->buildFormInputChoice() |
155 | 155 | : $this->buildFormInputMultiChoice(); |
156 | 156 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | 'name' => $this->args['name'].'[]', |
175 | 175 | 'text' => $this->args['options'][$key], |
176 | 176 | 'value' => $key, |
177 | - ])); |
|
177 | + ]) ); |
|
178 | 178 | }); |
179 | 179 | return $this->ul( $options ); |
180 | 180 | } |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | */ |
185 | 185 | protected function buildFormLabel() |
186 | 186 | { |
187 | - if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return; |
|
188 | - return $this->label([ |
|
187 | + if( empty($this->args['label']) || $this->args['type'] == 'hidden' )return; |
|
188 | + return $this->label( [ |
|
189 | 189 | 'for' => $this->args['id'], |
190 | 190 | 'text' => $this->args['label'], |
191 | - ]); |
|
191 | + ] ); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -205,11 +205,11 @@ discard block |
||
205 | 205 | protected function buildFormSelectOptions() |
206 | 206 | { |
207 | 207 | return array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) { |
208 | - return $carry.$this->option([ |
|
208 | + return $carry.$this->option( [ |
|
209 | 209 | 'selected' => $this->args['value'] == $key, |
210 | 210 | 'text' => $this->args['options'][$key], |
211 | 211 | 'value' => $key, |
212 | - ]); |
|
212 | + ] ); |
|
213 | 213 | }); |
214 | 214 | } |
215 | 215 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | */ |
227 | 227 | protected function buildTag() |
228 | 228 | { |
229 | - if( !in_array( $this->tag, static::TAGS_FORM )) { |
|
229 | + if( !in_array( $this->tag, static::TAGS_FORM ) ) { |
|
230 | 230 | return $this->buildDefaultTag(); |
231 | 231 | } |
232 | 232 | return call_user_func( [$this, 'buildForm'.ucfirst( $this->tag )] ).$this->buildFieldDescription(); |
@@ -238,13 +238,13 @@ discard block |
||
238 | 238 | */ |
239 | 239 | protected function normalize( ...$params ) |
240 | 240 | { |
241 | - if( glsr( Helper::class )->isStringOrNumeric( $params[0] )) { |
|
241 | + if( glsr( Helper::class )->isStringOrNumeric( $params[0] ) ) { |
|
242 | 242 | $this->setNameOrTextAttributeForTag( $params[0] ); |
243 | 243 | } |
244 | - if( is_array( $params[0] )) { |
|
244 | + if( is_array( $params[0] ) ) { |
|
245 | 245 | $this->args += $params[0]; |
246 | 246 | } |
247 | - else if( is_array( $params[1] )) { |
|
247 | + else if( is_array( $params[1] ) ) { |
|
248 | 248 | $this->args += $params[1]; |
249 | 249 | } |
250 | 250 | $this->args = glsr( BuilderDefaults::class )->merge( $this->args ); |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | protected function setTagFromMethod( $method ) |
270 | 270 | { |
271 | 271 | $this->tag = strtolower( $method ); |
272 | - if( in_array( $this->tag, static::INPUT_TYPES )) { |
|
272 | + if( in_array( $this->tag, static::INPUT_TYPES ) ) { |
|
273 | 273 | $this->args['type'] = $this->tag; |
274 | 274 | $this->tag = 'input'; |
275 | 275 | } |