1 | <?php |
||
10 | class Validator |
||
11 | { |
||
12 | /** |
||
13 | * Validates the configuration against the rules and requests/verifies items. |
||
14 | * |
||
15 | * @param array $config |
||
16 | * @param QuestionHelper $helper |
||
17 | * @param InputInterface $input |
||
18 | * @param OutputInterface $output |
||
19 | * |
||
20 | * @return array |
||
21 | */ |
||
22 | public static function validate($config, QuestionHelper $helper, InputInterface $input, OutputInterface $output) |
||
32 | |||
33 | /** |
||
34 | * Sets a configuration value from validation. |
||
35 | * |
||
36 | * @param array $config |
||
37 | * @param string $value |
||
38 | * @param string $ruleKey |
||
39 | */ |
||
40 | protected static function setValue($config, $value, $ruleKey) |
||
48 | |||
49 | /** |
||
50 | * Asks a question of the user. |
||
51 | * |
||
52 | * @param string $value |
||
53 | * @param array $rule |
||
54 | * @param QuestionHelper $helper |
||
55 | * @param InputInterface $input |
||
56 | * @param OutputInterface $output |
||
57 | * |
||
58 | * @return string |
||
59 | */ |
||
60 | protected static function askQuestion($value, $rule, QuestionHelper $helper, InputInterface $input, OutputInterface $output) |
||
83 | |||
84 | /** |
||
85 | * Get value from configuration. |
||
86 | * |
||
87 | * @param array $config |
||
88 | * @param string $ruleKey |
||
89 | * |
||
90 | * @return string |
||
91 | */ |
||
92 | protected static function getValue($config, $ruleKey) |
||
104 | |||
105 | /** |
||
106 | * Validation required rules. |
||
107 | * |
||
108 | * @return array |
||
109 | */ |
||
110 | protected static function rules() |
||
151 | } |
||
152 |