1 | <?php |
||
22 | class ConfigSchema implements IConfigSchema { |
||
23 | /** |
||
24 | * @var IConfig |
||
25 | */ |
||
26 | protected $config; |
||
27 | |||
28 | /** |
||
29 | * @var IValidator |
||
30 | */ |
||
31 | protected $validator; |
||
32 | |||
33 | /** |
||
34 | * ConfigSchema constructor. |
||
35 | * |
||
36 | * @param IConfig $config |
||
37 | * @param IValidator $validator |
||
38 | */ |
||
39 | public function __construct(IConfig $config, IValidator $validator = null) { |
||
47 | |||
48 | /** |
||
49 | * @param string $key |
||
50 | * @param string $message |
||
51 | * |
||
52 | * @return IValueNode |
||
53 | */ |
||
54 | public function hasValue($key, $message = null) { |
||
57 | |||
58 | /** |
||
59 | * @param string $key |
||
60 | * @param string $message |
||
61 | * |
||
62 | * @return IStringNode |
||
63 | */ |
||
64 | public function hasString($key, $message = null) { |
||
67 | |||
68 | /** |
||
69 | * @param string $key |
||
70 | * @param string $message |
||
71 | * |
||
72 | * @return INumericNode |
||
73 | */ |
||
74 | public function hasNumber($key, $message = null) { |
||
77 | |||
78 | /** |
||
79 | * @param string $key |
||
80 | * @param string $message |
||
81 | * |
||
82 | * @return IBooleanNode |
||
83 | */ |
||
84 | public function hasBoolean($key, $message = null) { |
||
87 | |||
88 | /** |
||
89 | * @param string $key |
||
90 | * @param string $message |
||
91 | * |
||
92 | * @return IArrayNode |
||
93 | */ |
||
94 | public function hasArray($key, $message = null) { |
||
97 | |||
98 | /** |
||
99 | * @param string $key |
||
100 | * @param string $message |
||
101 | * |
||
102 | * @return IStringNode |
||
103 | */ |
||
104 | public function hasArrayKeys($key, $message = null) { |
||
109 | |||
110 | /** |
||
111 | * @param string $key |
||
112 | * @param string $message |
||
113 | * |
||
114 | * @return StringNode |
||
115 | */ |
||
116 | public function hasArrayValues($key, $message = null) { |
||
121 | |||
122 | /** |
||
123 | * @throws ConfigValidationException |
||
124 | */ |
||
125 | public function assert() { |
||
142 | |||
143 | /** |
||
144 | * @return IValidationResult |
||
145 | */ |
||
146 | public function check() { |
||
151 | |||
152 | /** |
||
153 | * @param string $key |
||
154 | * @param IConstraint $constraint |
||
155 | * |
||
156 | * @return IConfigSchema |
||
157 | */ |
||
158 | public function constraint($key, IConstraint $constraint) { |
||
163 | |||
164 | /** |
||
165 | * @param string $key |
||
166 | * @param IConstraint[] $constraints |
||
167 | * |
||
168 | * @return IConfigSchema |
||
169 | */ |
||
170 | public function constraints($key, array $constraints) { |
||
175 | |||
176 | /** |
||
177 | * @return IValidator |
||
178 | */ |
||
179 | protected function createValidator() { |
||
182 | } |
||
183 |