1 | <?php declare(strict_types=1); |
||
12 | final class ConfigurationOptionsResolver |
||
13 | { |
||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | public const ACCESS_LEVEL_PROTECTED = 'protected'; |
||
18 | |||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | public const ACCESS_LEVEL_PRIVATE = 'private'; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | public const ACCESS_LEVEL_PUBLIC = 'public'; |
||
28 | |||
29 | /** |
||
30 | * @var mixed[] |
||
31 | */ |
||
32 | private $defaults = [ |
||
33 | // required |
||
34 | ConfigurationOptions::SOURCE => [], |
||
35 | ConfigurationOptions::DESTINATION => null, |
||
36 | // file finder |
||
37 | ConfigurationOptions::EXCLUDE => [], |
||
38 | ConfigurationOptions::EXTENSIONS => ['php'], |
||
39 | // template parameters |
||
40 | ConfigurationOptions::TITLE => '', |
||
41 | ConfigurationOptions::GOOGLE_ANALYTICS => '', |
||
42 | // filtering generated content |
||
43 | ConfigurationOptions::ACCESS_LEVELS => [self::ACCESS_LEVEL_PUBLIC, self::ACCESS_LEVEL_PROTECTED], |
||
44 | ConfigurationOptions::ANNOTATION_GROUPS => [], |
||
45 | ConfigurationOptions::BASE_URL => '', |
||
46 | ConfigurationOptions::CONFIG => '', |
||
47 | ConfigurationOptions::FORCE_OVERWRITE => false, |
||
48 | ConfigurationOptions::TEMPLATE_CONFIG => null, |
||
49 | // helpers - @todo: remove |
||
50 | ConfigurationOptions::VISIBILITY_LEVELS => [], |
||
51 | ]; |
||
52 | |||
53 | /** |
||
54 | * @var ThemeConfigFactory |
||
55 | */ |
||
56 | private $themeConfigFactory; |
||
57 | |||
58 | /** |
||
59 | * @var OptionsResolver |
||
60 | */ |
||
61 | private $resolver; |
||
62 | |||
63 | /** |
||
64 | * @var OptionsResolverFactory |
||
65 | */ |
||
66 | private $optionsResolverFactory; |
||
67 | |||
68 | /** |
||
69 | * @var FileSystem |
||
70 | */ |
||
71 | private $fileSystem; |
||
72 | |||
73 | public function __construct( |
||
82 | |||
83 | /** |
||
84 | * @param mixed[] $options |
||
85 | * @return mixed[] |
||
86 | */ |
||
87 | public function resolve(array $options): array |
||
97 | |||
98 | private function setDefaults(): void |
||
116 | |||
117 | /** |
||
118 | * @param mixed[] $options |
||
119 | */ |
||
120 | private function getAccessLevelForReflections(array $options): int |
||
138 | |||
139 | private function setRequired(): void |
||
143 | |||
144 | private function setAllowedValues(): void |
||
164 | |||
165 | private function setNormalizers(): void |
||
203 | |||
204 | private function allowedValuesForDestination(?string $destination): bool |
||
223 | |||
224 | /** |
||
225 | * @param string[] $source |
||
226 | */ |
||
227 | private function allowedValuesForSource(array $source): bool |
||
235 | |||
236 | private function ensureSourceExists(string $singleSource): void |
||
245 | } |
||
246 |