@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | /** |
| 24 | 24 | * @var array $rules |
| 25 | 25 | */ |
| 26 | - private $rules = []; |
|
| 26 | + private $rules = [ ]; |
|
| 27 | 27 | |
| 28 | 28 | public function __construct(Rule... $rules) |
| 29 | 29 | { |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function validate($data): Result |
| 39 | 39 | { |
| 40 | - $errors = []; |
|
| 40 | + $errors = [ ]; |
|
| 41 | 41 | foreach ($this->rules as $rule) { |
| 42 | 42 | |
| 43 | 43 | $result = $rule->validate($data); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @var Error $error |
| 50 | 50 | */ |
| 51 | 51 | foreach ($result->getErrors() as $error) { |
| 52 | - $errors[] = $error; |
|
| 52 | + $errors[ ] = $error; |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | $containsLower = preg_match('/[a-z]/', $text); |
| 91 | 91 | |
| 92 | 92 | if ($this->strictCheck) |
| 93 | - return !preg_match('/[\W]/', $text) && $containsLower; |
|
| 93 | + return !preg_match('/[\W]/', $text) && $containsLower; |
|
| 94 | 94 | else |
| 95 | 95 | return $containsLower; |
| 96 | 96 | } |
@@ -19,13 +19,13 @@ |
||
| 19 | 19 | * Handy for username validations |
| 20 | 20 | * @var array $allowedSpecialChars |
| 21 | 21 | */ |
| 22 | - protected $allowedSpecialChars = []; |
|
| 22 | + protected $allowedSpecialChars = [ ]; |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * AlphaNumeric constructor. |
| 26 | 26 | * @param array $allowedSpecialChars |
| 27 | 27 | */ |
| 28 | - public function __construct($allowedSpecialChars = []) |
|
| 28 | + public function __construct($allowedSpecialChars = [ ]) |
|
| 29 | 29 | { |
| 30 | 30 | $this->allowedSpecialChars = $allowedSpecialChars; |
| 31 | 31 | } |
@@ -26,17 +26,17 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | private $username; |
| 28 | 28 | |
| 29 | - private function getOption(int $key, $arr = [], $default) { |
|
| 30 | - return isset($arr[$key]) ? $arr[$key]: $default; |
|
| 29 | + private function getOption(int $key, $arr = [ ], $default) { |
|
| 30 | + return isset($arr[ $key ]) ? $arr[ $key ] : $default; |
|
| 31 | 31 | } |
| 32 | - public function __construct(string $username, $options = [], Validator $validator = null) |
|
| 32 | + public function __construct(string $username, $options = [ ], Validator $validator = null) |
|
| 33 | 33 | { |
| 34 | 34 | if ($validator == null) { |
| 35 | 35 | // use the default validator |
| 36 | 36 | $validator = new UsernameValidator( |
| 37 | 37 | $this->getOption(self::OPT_MIN_LEN, $options, 4), |
| 38 | 38 | $this->getOption(self::OPT_MAX_LEN, $options, 12), |
| 39 | - $this->getOption(self::OPT_ALLOWED_SPECIAL_CHARS, $options, ['-', '_'])); |
|
| 39 | + $this->getOption(self::OPT_ALLOWED_SPECIAL_CHARS, $options, [ '-', '_' ])); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $result = $validator->validate($username, $options); |
@@ -30,9 +30,9 @@ |
||
| 30 | 30 | /** |
| 31 | 31 | * @var array $allowedChars |
| 32 | 32 | */ |
| 33 | - private $allowedSpecialChars = []; |
|
| 33 | + private $allowedSpecialChars = [ ]; |
|
| 34 | 34 | |
| 35 | - public function __construct(int $minLength = 4, int $maxLength = 12, $allowedSpecialChars = []) |
|
| 35 | + public function __construct(int $minLength = 4, int $maxLength = 12, $allowedSpecialChars = [ ]) |
|
| 36 | 36 | { |
| 37 | 37 | $this->minLength = $minLength; |
| 38 | 38 | $this->maxLength = $maxLength; |