Conditions | 7 |
Paths | 8 |
Total Lines | 23 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
47 | public function validate($field, $input, array $params = array()) |
||
48 | { |
||
49 | if ($input instanceof \SplFileInfo) { |
||
50 | if ($input->isDir()) { |
||
51 | $input = $input->getBasename(); |
||
52 | } else { |
||
53 | return false; |
||
54 | } |
||
55 | } else { |
||
56 | if (! is_dir($input)) { |
||
57 | return false; |
||
58 | } |
||
59 | } |
||
60 | |||
61 | $d = dir($input); |
||
62 | while (false !== ($entry = $d->read())) { |
||
63 | if ($entry != '.' && $entry != '..') { |
||
64 | return false; |
||
65 | } |
||
66 | } |
||
67 | |||
68 | return true; |
||
69 | } |
||
70 | } |
||
71 | } |