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