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) |
||
34 | |||
35 | /** |
||
36 | * Asks if the theme should be installed and removes the theme specific configuration if not. |
||
37 | * |
||
38 | * @param array $config |
||
39 | * @param QuestionHelper $helper |
||
40 | * @param InputInterface $input |
||
41 | * @param OutputInterface $output |
||
42 | * |
||
43 | * @return array |
||
44 | */ |
||
45 | protected static function shouldThemeBeInstalled($config, QuestionHelper $helper, InputInterface $input, OutputInterface $output) |
||
63 | |||
64 | /** |
||
65 | * Sets a configuration value from validation. |
||
66 | * |
||
67 | * @param array $config |
||
68 | * @param string $value |
||
69 | * @param string $ruleKey |
||
70 | */ |
||
71 | protected static function setValue($config, $value, $ruleKey) |
||
79 | |||
80 | /** |
||
81 | * Asks a question of the user. |
||
82 | * |
||
83 | * @param string $value |
||
84 | * @param array $rule |
||
85 | * @param QuestionHelper $helper |
||
86 | * @param InputInterface $input |
||
87 | * @param OutputInterface $output |
||
88 | * |
||
89 | * @return string |
||
90 | */ |
||
91 | protected static function askQuestion($value, $rule, QuestionHelper $helper, InputInterface $input, OutputInterface $output) |
||
114 | |||
115 | /** |
||
116 | * Get value from configuration. |
||
117 | * |
||
118 | * @param array $config |
||
119 | * @param string $ruleKey |
||
120 | * |
||
121 | * @return string |
||
122 | */ |
||
123 | protected static function getValue($config, $ruleKey) |
||
135 | |||
136 | /** |
||
137 | * Validation required rules. |
||
138 | * |
||
139 | * @return array |
||
140 | */ |
||
141 | protected static function rules() |
||
182 | } |
||
183 |