@@ -36,7 +36,7 @@ |
||
| 36 | 36 | |
| 37 | 37 | public function getFirstError() : Error |
| 38 | 38 | { |
| 39 | - return $this->errors[0]; |
|
| 39 | + return $this->errors[ 0 ]; |
|
| 40 | 40 | |
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | \ No newline at end of file |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | abstract class Result |
| 8 | 8 | { |
| 9 | 9 | private $valid; |
| 10 | - protected $errors = []; |
|
| 10 | + protected $errors = [ ]; |
|
| 11 | 11 | |
| 12 | 12 | public function __construct(bool $valid, Error... $errors) |
| 13 | 13 | { |
@@ -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 | } |
@@ -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; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | /** |
| 25 | 25 | * @var array $rules |
| 26 | 26 | */ |
| 27 | - private $rules = []; |
|
| 27 | + private $rules = [ ]; |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * ForAll constructor. |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | /** |
| 49 | 49 | * @var Error $errors[] |
| 50 | 50 | */ |
| 51 | - $errors = []; |
|
| 51 | + $errors = [ ]; |
|
| 52 | 52 | foreach ($this->rules as $rule) { |
| 53 | 53 | |
| 54 | 54 | $result = $rule->validate($data); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * @var Error $error |
| 60 | 60 | */ |
| 61 | 61 | foreach ($result->getErrors() as $error) { |
| 62 | - $errors[] = $error; |
|
| 62 | + $errors[ ] = $error; |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | /** |
| 36 | 36 | * @var array|Rule[] $rules |
| 37 | 37 | */ |
| 38 | - private $rules = []; |
|
| 38 | + private $rules = [ ]; |
|
| 39 | 39 | /** |
| 40 | 40 | * ForAtLeast constructor. |
| 41 | 41 | * @param int $numOfRules |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | /** |
| 61 | 61 | * @var array|Error[] $errors |
| 62 | 62 | */ |
| 63 | - $errors = []; |
|
| 63 | + $errors = [ ]; |
|
| 64 | 64 | $passed = 0; |
| 65 | 65 | |
| 66 | 66 | foreach ($this->rules as $rule) { |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * @var Error $error |
| 73 | 73 | */ |
| 74 | 74 | foreach ($result->getErrors() as $error) { |
| 75 | - $errors[] = $error; |
|
| 75 | + $errors[ ] = $error; |
|
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | else { |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | * @throws \Phypes\Exception\InvalidAggregateRule |
| 25 | 25 | * @throws \Phypes\Exception\InvalidRuleOption |
| 26 | 26 | */ |
| 27 | - public function __construct(string $password, $options =[], Validator $validator = null) |
|
| 27 | + public function __construct(string $password, $options = [ ], Validator $validator = null) |
|
| 28 | 28 | { |
| 29 | 29 | if ($validator == null) { |
| 30 | 30 | // use the default validator |
@@ -28,14 +28,14 @@ |
||
| 28 | 28 | private $username; |
| 29 | 29 | |
| 30 | 30 | |
| 31 | - public function __construct(string $username, $options = [], Validator $validator = null) |
|
| 31 | + public function __construct(string $username, $options = [ ], Validator $validator = null) |
|
| 32 | 32 | { |
| 33 | 33 | if ($validator == null) { |
| 34 | 34 | // use the default validator |
| 35 | 35 | $validator = new UsernameValidator( |
| 36 | 36 | getOptionalValue(self::OPT_MIN_LEN, $options, 4), |
| 37 | 37 | getOptionalValue(self::OPT_MAX_LEN, $options, 12), |
| 38 | - getOptionalValue(self::OPT_ALLOWED_SPECIAL_CHARS, $options, ['-', '_'])); |
|
| 38 | + getOptionalValue(self::OPT_ALLOWED_SPECIAL_CHARS, $options, [ '-', '_' ])); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $result = $validator->validate($username, $options); |
@@ -17,5 +17,5 @@ |
||
| 17 | 17 | * @return mixed |
| 18 | 18 | */ |
| 19 | 19 | function getOptionalValue(int $key, array $arr, $default) { |
| 20 | - return isset($arr[$key]) ? $arr[$key]: $default; |
|
| 20 | + return isset($arr[ $key ]) ? $arr[ $key ] : $default; |
|
| 21 | 21 | } |
| 22 | 22 | \ No newline at end of file |