1 | <?php |
||
27 | class Finder implements PluginInterface |
||
28 | { |
||
29 | const ALGORITHM_LEGACY = 0; |
||
30 | const ALGORITHM_OPTIMIZED = 1; |
||
31 | |||
32 | /** @var FilesystemInterface */ |
||
33 | private $filesystem; |
||
34 | |||
35 | 1 | /** @var int */ |
|
36 | private $algorithm = self::ALGORITHM_LEGACY; |
||
37 | 1 | ||
38 | /** |
||
39 | * Get the method name. |
||
40 | */ |
||
41 | public function getMethod(): string |
||
45 | 1 | ||
46 | 1 | /** |
|
47 | * Set the Filesystem object. |
||
48 | */ |
||
49 | public function setFilesystem(FilesystemInterface $filesystem): void |
||
53 | |||
54 | 1 | /** |
|
55 | * Find the specified files |
||
56 | 1 | * |
|
57 | 1 | * Note that only found *files* are yielded at this level, |
|
58 | 1 | * which go back to the caller. |
|
59 | */ |
||
60 | public function handle(SpecificationInterface $specification): Generator |
||
68 | |||
69 | /** |
||
70 | * Recursively yield files that meet the specification |
||
71 | 1 | * |
|
72 | * Note that directories are also yielded at this level, |
||
73 | 1 | * since they have to be recursed into. Yielded directories |
|
74 | 1 | * will not make their way back to the caller, as they are filtered out |
|
75 | 1 | * by {@link handle()}. |
|
76 | 1 | * @param SpecificationInterface $specification |
|
77 | * @param string $path |
||
78 | * @return Generator |
||
79 | 1 | */ |
|
80 | 1 | private function yieldFilesInPath(SpecificationInterface $specification, string $path): Generator |
|
101 | |||
102 | /** |
||
103 | * @return int |
||
104 | */ |
||
105 | public function getAlgorithm(): int |
||
109 | |||
110 | /** |
||
111 | * @param int $algorithm |
||
112 | */ |
||
113 | public function setAlgorithm(int $algorithm): void |
||
117 | } |
||
118 |