Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
8 / 8 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
recursive_dot_prefix_filter_iterator | |
100.00% |
8 / 8 |
|
100.00% |
3 / 3 |
4 | |
100.00% |
1 / 1 |
accept | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
getSubPath | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
getSubPathname | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | /** |
3 | * |
4 | * This file is part of the phpBB Forum Software package. |
5 | * |
6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
7 | * @license GNU General Public License, version 2 (GPL-2.0) |
8 | * |
9 | * For full copyright and license information, please see |
10 | * the docs/CREDITS.txt file. |
11 | * |
12 | */ |
13 | |
14 | namespace phpbb\finder; |
15 | |
16 | /** |
17 | * Class recursive_dot_prefix_filter_iterator |
18 | * |
19 | * This filter ignores directories starting with a dot. |
20 | * When searching for php classes and template files of extensions |
21 | * we don't need to look inside these directories. |
22 | */ |
23 | class recursive_dot_prefix_filter_iterator extends \RecursiveFilterIterator |
24 | { |
25 | /** |
26 | * Check whether the current element of the iterator is acceptable |
27 | * |
28 | * @return bool |
29 | */ |
30 | public function accept(): bool |
31 | { |
32 | $filename = $this->current()->getFilename(); |
33 | return $filename[0] !== '.' || !$this->current()->isDir(); |
34 | } |
35 | |
36 | /** |
37 | * Get sub path |
38 | * |
39 | * @return string |
40 | */ |
41 | public function getSubPath(): string |
42 | { |
43 | $directory_iterator = $this->getInnerIterator(); |
44 | assert($directory_iterator instanceof \RecursiveDirectoryIterator); |
45 | return $directory_iterator->getSubPath(); |
46 | } |
47 | |
48 | /** |
49 | * Get sub path and name |
50 | * |
51 | * @return string |
52 | */ |
53 | public function getSubPathname(): string |
54 | { |
55 | $directory_iterator = $this->getInnerIterator(); |
56 | assert($directory_iterator instanceof \RecursiveDirectoryIterator); |
57 | return $directory_iterator->getSubPathname(); |
58 | } |
59 | } |