1: <?php
2: 3: 4: 5: 6: 7:
8:
9: namespace Wei\Validator;
10:
11: 12: 13: 14: 15:
16: class Dir extends BaseValidator
17: {
18: protected $notFoundMessage = '%name% must be an existing directory';
19:
20: protected $negativeMessage = '%name% must be a non-existing directory';
21:
22: 23: 24:
25: protected function doValidate($input)
26: {
27: if (!$this->isString($input)) {
28: $this->addError('notString');
29: return false;
30: }
31:
32: if (!is_dir($input) && !stream_resolve_include_path($input)) {
33: $this->addError('notFound');
34: return false;
35: }
36:
37: return true;
38: }
39: }
40: