@@ -42,7 +42,9 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function build() |
| 44 | 44 | { |
| 45 | - if( !$this->field['is_valid'] )return; |
|
| 45 | + if( !$this->field['is_valid'] ) { |
|
| 46 | + return; |
|
| 47 | + } |
|
| 46 | 48 | if( $this->field['type'] == 'hidden' ) { |
| 47 | 49 | return glsr( Builder::class )->hidden( $this->field ); |
| 48 | 50 | } |
@@ -181,7 +183,9 @@ discard block |
||
| 181 | 183 | 'name', 'type', |
| 182 | 184 | ]; |
| 183 | 185 | foreach( $requiredValues as $value ) { |
| 184 | - if( isset( $this->field[$value] ))continue; |
|
| 186 | + if( isset( $this->field[$value] )) { |
|
| 187 | + continue; |
|
| 188 | + } |
|
| 185 | 189 | $missingValues[] = $value; |
| 186 | 190 | $isValid = $this->field['is_valid'] = false; |
| 187 | 191 | } |
@@ -198,11 +202,15 @@ discard block |
||
| 198 | 202 | */ |
| 199 | 203 | protected function normalize() |
| 200 | 204 | { |
| 201 | - if( !$this->isFieldValid() )return; |
|
| 205 | + if( !$this->isFieldValid() ) { |
|
| 206 | + return; |
|
| 207 | + } |
|
| 202 | 208 | $field = $this->field; |
| 203 | 209 | foreach( $field as $key => $value ) { |
| 204 | 210 | $methodName = glsr( Helper::class )->buildMethodName( $key, 'normalize' ); |
| 205 | - if( !method_exists( $this, $methodName ))continue; |
|
| 211 | + if( !method_exists( $this, $methodName )) { |
|
| 212 | + continue; |
|
| 213 | + } |
|
| 206 | 214 | $this->$methodName(); |
| 207 | 215 | } |
| 208 | 216 | $this->normalizeFieldId(); |
@@ -215,7 +223,9 @@ discard block |
||
| 215 | 223 | */ |
| 216 | 224 | protected function normalizeDependsOn() |
| 217 | 225 | { |
| 218 | - if( empty( $this->field['depends_on'] ) || !is_array( $this->field['depends_on'] ))return; |
|
| 226 | + if( empty( $this->field['depends_on'] ) || !is_array( $this->field['depends_on'] )) { |
|
| 227 | + return; |
|
| 228 | + } |
|
| 219 | 229 | $path = key( $this->field['depends_on'] ); |
| 220 | 230 | $value = $this->field['depends_on'][$path]; |
| 221 | 231 | $this->field['depends_on'] = json_encode([ |
@@ -230,7 +240,9 @@ discard block |
||
| 230 | 240 | */ |
| 231 | 241 | protected function normalizeFieldId() |
| 232 | 242 | { |
| 233 | - if( isset( $this->field['id'] ) || empty( $this->field['label'] ))return; |
|
| 243 | + if( isset( $this->field['id'] ) || empty( $this->field['label'] )) { |
|
| 244 | + return; |
|
| 245 | + } |
|
| 234 | 246 | $this->field['id'] = glsr( Helper::class )->convertNameToId( $this->field['name'] ); |
| 235 | 247 | } |
| 236 | 248 | |
@@ -256,7 +268,9 @@ discard block |
||
| 256 | 268 | */ |
| 257 | 269 | protected function normalizeFieldValue() |
| 258 | 270 | { |
| 259 | - if( isset( $this->field['value'] ))return; |
|
| 271 | + if( isset( $this->field['value'] )) { |
|
| 272 | + return; |
|
| 273 | + } |
|
| 260 | 274 | $this->field['value'] = glsr( OptionManager::class )->get( |
| 261 | 275 | $this->field['path'], |
| 262 | 276 | $this->getFieldDefault() |
@@ -268,7 +282,9 @@ discard block |
||
| 268 | 282 | */ |
| 269 | 283 | protected function normalizeLabel() |
| 270 | 284 | { |
| 271 | - if( !$this->field['is_setting'] )return; |
|
| 285 | + if( !$this->field['is_setting'] ) { |
|
| 286 | + return; |
|
| 287 | + } |
|
| 272 | 288 | $this->field['legend'] = $this->field['label']; |
| 273 | 289 | unset( $this->field['label'] ); |
| 274 | 290 | } |