@@ -65,14 +65,14 @@ |
||
| 65 | 65 | public static function getValidator(): ConfigValidatorInterface |
| 66 | 66 | { |
| 67 | 67 | return Validate::arr(false) |
| 68 | - ->required('driver', v::stringType()->in( |
|
| 69 | - [ConnectionConfigInterface::DRIVER_MYSQL] |
|
| 70 | - ) |
|
| 71 | - ) |
|
| 72 | - ->required('user', v::stringType()) |
|
| 73 | - ->required('password', v::stringType()) |
|
| 74 | - ->required('host', v::stringType()) |
|
| 75 | - ->optional('port', v::intVal(), 3306) |
|
| 76 | - ->required('dbName', v::stringType()); |
|
| 68 | + ->required('driver', v::stringType()->in( |
|
| 69 | + [ConnectionConfigInterface::DRIVER_MYSQL] |
|
| 70 | + ) |
|
| 71 | + ) |
|
| 72 | + ->required('user', v::stringType()) |
|
| 73 | + ->required('password', v::stringType()) |
|
| 74 | + ->required('host', v::stringType()) |
|
| 75 | + ->optional('port', v::intVal(), 3306) |
|
| 76 | + ->required('dbName', v::stringType()); |
|
| 77 | 77 | } |
| 78 | 78 | } |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public function __construct(array $options = []) |
| 26 | 26 | { |
| 27 | - $options = static::getValidator()->validate($options); |
|
| 28 | - $this->schema = $options['schema']; |
|
| 29 | - $this->exclude = $options['exclude']; |
|
| 30 | - $this->connection = new ConnectionConfig($options['connection']); |
|
| 27 | + $options = static::getValidator()->validate($options); |
|
| 28 | + $this->schema = $options['schema']; |
|
| 29 | + $this->exclude = $options['exclude']; |
|
| 30 | + $this->connection = new ConnectionConfig($options['connection']); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public function getSchema(): string |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | public static function getValidator(): ConfigValidatorInterface |
| 44 | 44 | { |
| 45 | 45 | return Validate::arr(false) |
| 46 | - ->required('connection', v::arrayType()->addRule( |
|
| 47 | - ConnectionConfig::getValidator()->getValidator() |
|
| 48 | - )) |
|
| 49 | - ->required('schema', v::stringType()) |
|
| 50 | - ->optional('exclude', v::arrayVal()->each(v::stringType()), []); |
|
| 46 | + ->required('connection', v::arrayType()->addRule( |
|
| 47 | + ConnectionConfig::getValidator()->getValidator() |
|
| 48 | + )) |
|
| 49 | + ->required('schema', v::stringType()) |
|
| 50 | + ->optional('exclude', v::arrayVal()->each(v::stringType()), []); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -42,15 +42,15 @@ |
||
| 42 | 42 | public function __construct() |
| 43 | 43 | { |
| 44 | 44 | $this->validator = Validate::arr(false) |
| 45 | - ->optional('defaults.group', v::stringType()->alnum('_'), static::DEFAULT_GROUP) |
|
| 46 | - ->optional('defaults.path', v::stringType()->directory(), static::DEFAULT_PATH) |
|
| 47 | - ->required( |
|
| 48 | - 'schemas', |
|
| 49 | - v::arrayVal()->each( |
|
| 50 | - SchemaConfig::getValidator() |
|
| 51 | - ->getValidator() |
|
| 52 | - ) |
|
| 53 | - ); |
|
| 45 | + ->optional('defaults.group', v::stringType()->alnum('_'), static::DEFAULT_GROUP) |
|
| 46 | + ->optional('defaults.path', v::stringType()->directory(), static::DEFAULT_PATH) |
|
| 47 | + ->required( |
|
| 48 | + 'schemas', |
|
| 49 | + v::arrayVal()->each( |
|
| 50 | + SchemaConfig::getValidator() |
|
| 51 | + ->getValidator() |
|
| 52 | + ) |
|
| 53 | + ); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |