@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | $className = str_replace( '.php', '', $file ); |
| 25 | 25 | $version = str_replace( ['Upgrade_', '_'], ['', '.'], $className ); |
| 26 | 26 | $versionSuffix = preg_replace( '/[\d.]+(.+)?/', '${1}', glsr()->version ); // allow alpha/beta versions |
| 27 | - if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ))return; |
|
| 27 | + if( version_compare( $this->currentVersion(), $version.$versionSuffix, '>=' ) )return; |
|
| 28 | 28 | glsr( 'Modules\\Upgrader\\'.$className ); |
| 29 | 29 | glsr_log()->info( 'Completed Upgrade for v'.$version.$versionSuffix ); |
| 30 | 30 | }); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $this->setReviewCounts(); |
| 42 | 42 | $this->updateVersionFrom( $version ); |
| 43 | 43 | } |
| 44 | - else if( !glsr( OptionManager::class )->get( 'last_review_count', false )) { |
|
| 44 | + else if( !glsr( OptionManager::class )->get( 'last_review_count', false ) ) { |
|
| 45 | 45 | $this->setReviewCounts(); |
| 46 | 46 | } |
| 47 | 47 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | foreach( $this->rules as $attribute => $rules ) { |
| 75 | 75 | foreach( $rules as $rule ) { |
| 76 | 76 | $this->validateAttribute( $attribute, $rule ); |
| 77 | - if( $this->shouldStopValidating( $attribute ))break; |
|
| 77 | + if( $this->shouldStopValidating( $attribute ) )break; |
|
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | return $this->errors; |
@@ -89,13 +89,13 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function validateAttribute( $attribute, $rule ) |
| 91 | 91 | { |
| 92 | - list( $rule, $parameters ) = $this->parseRule( $rule ); |
|
| 92 | + list($rule, $parameters) = $this->parseRule( $rule ); |
|
| 93 | 93 | if( $rule == '' )return; |
| 94 | 94 | $value = $this->getValue( $attribute ); |
| 95 | - if( !method_exists( $this, $method = 'validate'.$rule )) { |
|
| 95 | + if( !method_exists( $this, $method = 'validate'.$rule ) ) { |
|
| 96 | 96 | throw new BadMethodCallException( "Method [$method] does not exist." ); |
| 97 | 97 | } |
| 98 | - if( !$this->$method( $value, $attribute, $parameters )) { |
|
| 98 | + if( !$this->$method( $value, $attribute, $parameters ) ) { |
|
| 99 | 99 | $this->addFailure( $attribute, $rule, $parameters ); |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | protected function getMessage( $attribute, $rule, array $parameters ) |
| 146 | 146 | { |
| 147 | - if( in_array( $rule, $this->sizeRules )) { |
|
| 147 | + if( in_array( $rule, $this->sizeRules ) ) { |
|
| 148 | 148 | return $this->getSizeMessage( $attribute, $rule, $parameters ); |
| 149 | 149 | } |
| 150 | 150 | $lowerRule = glsr( Helper::class )->snakeCase( $rule ); |
@@ -159,11 +159,11 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | protected function getRule( $attribute, $rules ) |
| 161 | 161 | { |
| 162 | - if( !array_key_exists( $attribute, $this->rules ))return; |
|
| 162 | + if( !array_key_exists( $attribute, $this->rules ) )return; |
|
| 163 | 163 | $rules = (array)$rules; |
| 164 | 164 | foreach( $this->rules[$attribute] as $rule ) { |
| 165 | - list( $rule, $parameters ) = $this->parseRule( $rule ); |
|
| 166 | - if( in_array( $rule, $rules )) { |
|
| 165 | + list($rule, $parameters) = $this->parseRule( $rule ); |
|
| 166 | + if( in_array( $rule, $rules ) ) { |
|
| 167 | 167 | return [$rule, $parameters]; |
| 168 | 168 | } |
| 169 | 169 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | if( is_numeric( $value ) && $hasNumeric ) { |
| 182 | 182 | return $value; |
| 183 | 183 | } |
| 184 | - else if( is_array( $value )) { |
|
| 184 | + else if( is_array( $value ) ) { |
|
| 185 | 185 | return count( $value ); |
| 186 | 186 | } |
| 187 | 187 | return function_exists( 'mb_strlen' ) |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | protected function getValue( $attribute ) |
| 211 | 211 | { |
| 212 | - if( isset( $this->data[$attribute] )) { |
|
| 212 | + if( isset($this->data[$attribute]) ) { |
|
| 213 | 213 | return $this->data[$attribute]; |
| 214 | 214 | } |
| 215 | 215 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | protected function hasRule( $attribute, $rules ) |
| 224 | 224 | { |
| 225 | - return !is_null( $this->getRule( $attribute, $rules )); |
|
| 225 | + return !is_null( $this->getRule( $attribute, $rules ) ); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /** |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | { |
| 261 | 261 | $parameters = []; |
| 262 | 262 | if( strpos( $rule, ':' ) !== false ) { |
| 263 | - list( $rule, $parameter ) = explode( ':', $rule, 2 ); |
|
| 263 | + list($rule, $parameter) = explode( ':', $rule, 2 ); |
|
| 264 | 264 | $parameters = $this->parseParameters( $rule, $parameter ); |
| 265 | 265 | } |
| 266 | 266 | $rule = glsr( Helper::class )->camelCase( $rule ); |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | protected function shouldStopValidating( $attribute ) |
| 290 | 290 | { |
| 291 | 291 | return $this->hasRule( $attribute, $this->implicitRules ) |
| 292 | - && isset( $this->failedRules[$attribute] ) |
|
| 292 | + && isset($this->failedRules[$attribute]) |
|
| 293 | 293 | && array_intersect( array_keys( $this->failedRules[$attribute] ), $this->implicitRules ); |
| 294 | 294 | } |
| 295 | 295 | |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | protected function translator( $key, array $parameters ) |
| 303 | 303 | { |
| 304 | 304 | $strings = glsr( ValidationStringsDefaults::class )->defaults(); |
| 305 | - if( isset( $strings[$key] )) { |
|
| 305 | + if( isset($strings[$key]) ) { |
|
| 306 | 306 | return $this->replace( $strings[$key], $parameters ); |
| 307 | 307 | } |
| 308 | 308 | return "error"; |