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 | /** @var int */ |
||
36 | private $algorithm = self::ALGORITHM_LEGACY; |
||
37 | |||
38 | /** |
||
39 | * Get the method name. |
||
40 | */ |
||
41 | 1 | public function getMethod(): string |
|
45 | |||
46 | /** |
||
47 | * Set the Filesystem object. |
||
48 | */ |
||
49 | 2 | public function setFilesystem(FilesystemInterface $filesystem): void |
|
53 | |||
54 | /** |
||
55 | * Find the specified files |
||
56 | * |
||
57 | * Note that only found *files* are yielded at this level, |
||
58 | * which go back to the caller. |
||
59 | */ |
||
60 | 2 | public function handle(SpecificationInterface $specification): Generator |
|
68 | |||
69 | /** |
||
70 | * Recursively yield files that meet the specification |
||
71 | * |
||
72 | * Note that directories are also yielded at this level, |
||
73 | * since they have to be recursed into. Yielded directories |
||
74 | * will not make their way back to the caller, as they are filtered out |
||
75 | * by {@link handle()}. |
||
76 | * @param SpecificationInterface $specification |
||
77 | * @param string $path |
||
78 | * @return Generator |
||
79 | */ |
||
80 | 2 | 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 |