@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | $instance = new static(); |
| 67 | 67 | $instance->setTagFromMethod( $method ); |
| 68 | - call_user_func_array( [$instance, 'normalize'], $args += ['',''] ); |
|
| 68 | + call_user_func_array( [$instance, 'normalize'], $args += ['', ''] ); |
|
| 69 | 69 | $tags = array_merge( static::TAGS_FORM, static::TAGS_STRUCTURE, static::TAGS_TEXT ); |
| 70 | 70 | $generatedTag = in_array( $instance->tag, $tags ) |
| 71 | 71 | ? $instance->buildTag() |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | 'render' => 'is_bool', |
| 90 | 90 | 'tag' => 'is_string', |
| 91 | 91 | ]; |
| 92 | - if( !isset( $properties[$property] ) |
|
| 93 | - || empty( array_filter( [$value], $properties[$property] )) |
|
| 92 | + if( !isset($properties[$property]) |
|
| 93 | + || empty(array_filter( [$value], $properties[$property] )) |
|
| 94 | 94 | )return; |
| 95 | 95 | $this->$property = $value; |
| 96 | 96 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function getOpeningTag() |
| 110 | 110 | { |
| 111 | - $attributes = glsr( Attributes::class )->{$this->tag}( $this->args )->toString(); |
|
| 111 | + $attributes = glsr( Attributes::class )->{$this->tag}($this->args)->toString(); |
|
| 112 | 112 | return '<'.trim( $this->tag.' '.$attributes ).'>'; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | protected function buildCustomField() |
| 119 | 119 | { |
| 120 | 120 | $className = glsr( Helper::class )->buildClassName( $this->tag, __NAMESPACE__.'\Fields' ); |
| 121 | - if( !class_exists( $className )) { |
|
| 121 | + if( !class_exists( $className ) ) { |
|
| 122 | 122 | glsr_log()->error( 'Field missing: '.$className ); |
| 123 | 123 | return; |
| 124 | 124 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | protected function buildDefaultTag( $text = '' ) |
| 132 | 132 | { |
| 133 | - if( empty( $text )) { |
|
| 133 | + if( empty($text) ) { |
|
| 134 | 134 | $text = $this->args['text']; |
| 135 | 135 | } |
| 136 | 136 | return $this->getOpeningTag().$text.$this->getClosingTag(); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | protected function buildFieldDescription() |
| 143 | 143 | { |
| 144 | - if( !empty( $this->args['description'] )) { |
|
| 144 | + if( !empty($this->args['description']) ) { |
|
| 145 | 145 | return $this->small( $this->args['description'] ); |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -151,10 +151,10 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | protected function buildFormInput() |
| 153 | 153 | { |
| 154 | - if( !in_array( $this->args['type'], ['checkbox', 'radio'] )) { |
|
| 154 | + if( !in_array( $this->args['type'], ['checkbox', 'radio'] ) ) { |
|
| 155 | 155 | return $this->buildFormLabel().$this->getOpeningTag(); |
| 156 | 156 | } |
| 157 | - return empty( $this->args['options'] ) |
|
| 157 | + return empty($this->args['options']) |
|
| 158 | 158 | ? $this->buildFormInputChoice() |
| 159 | 159 | : $this->buildFormInputMultiChoice(); |
| 160 | 160 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | 'name' => $this->args['name'].'[]', |
| 179 | 179 | 'text' => $this->args['options'][$key], |
| 180 | 180 | 'value' => $key, |
| 181 | - ])); |
|
| 181 | + ]) ); |
|
| 182 | 182 | }); |
| 183 | 183 | return $this->ul( $options ); |
| 184 | 184 | } |
@@ -188,11 +188,11 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | protected function buildFormLabel() |
| 190 | 190 | { |
| 191 | - if( empty( $this->args['label'] ) || $this->args['type'] == 'hidden' )return; |
|
| 192 | - return $this->label([ |
|
| 191 | + if( empty($this->args['label']) || $this->args['type'] == 'hidden' )return; |
|
| 192 | + return $this->label( [ |
|
| 193 | 193 | 'for' => $this->args['id'], |
| 194 | 194 | 'text' => $this->args['label'], |
| 195 | - ]); |
|
| 195 | + ] ); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | /** |
@@ -209,11 +209,11 @@ discard block |
||
| 209 | 209 | protected function buildFormSelectOptions() |
| 210 | 210 | { |
| 211 | 211 | return array_reduce( array_keys( $this->args['options'] ), function( $carry, $key ) { |
| 212 | - return $carry.$this->option([ |
|
| 212 | + return $carry.$this->option( [ |
|
| 213 | 213 | 'selected' => $this->args['value'] == $key, |
| 214 | 214 | 'text' => $this->args['options'][$key], |
| 215 | 215 | 'value' => $key, |
| 216 | - ]); |
|
| 216 | + ] ); |
|
| 217 | 217 | }); |
| 218 | 218 | } |
| 219 | 219 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | protected function buildTag() |
| 232 | 232 | { |
| 233 | - if( !in_array( $this->tag, static::TAGS_FORM )) { |
|
| 233 | + if( !in_array( $this->tag, static::TAGS_FORM ) ) { |
|
| 234 | 234 | return $this->buildDefaultTag(); |
| 235 | 235 | } |
| 236 | 236 | return call_user_func( [$this, 'buildForm'.ucfirst( $this->tag )] ).$this->buildFieldDescription(); |
@@ -242,13 +242,13 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | protected function normalize( ...$params ) |
| 244 | 244 | { |
| 245 | - if( is_string( $params[0] ) || is_numeric( $params[0] )) { |
|
| 245 | + if( is_string( $params[0] ) || is_numeric( $params[0] ) ) { |
|
| 246 | 246 | $this->setNameOrTextAttributeForTag( $params[0] ); |
| 247 | 247 | } |
| 248 | - if( is_array( $params[0] )) { |
|
| 248 | + if( is_array( $params[0] ) ) { |
|
| 249 | 249 | $this->args += $params[0]; |
| 250 | 250 | } |
| 251 | - else if( is_array( $params[1] )) { |
|
| 251 | + else if( is_array( $params[1] ) ) { |
|
| 252 | 252 | $this->args += $params[1]; |
| 253 | 253 | } |
| 254 | 254 | $this->args = glsr( BuilderDefaults::class )->merge( $this->args ); |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | protected function setTagFromMethod( $method ) |
| 274 | 274 | { |
| 275 | 275 | $this->tag = strtolower( $method ); |
| 276 | - if( in_array( $this->tag, static::INPUT_TYPES )) { |
|
| 276 | + if( in_array( $this->tag, static::INPUT_TYPES ) ) { |
|
| 277 | 277 | $this->args['type'] = $this->tag; |
| 278 | 278 | $this->tag = 'input'; |
| 279 | 279 | } |