1 | <?php declare(strict_types=1); |
||
11 | class ScriptFinder |
||
12 | { |
||
13 | const VALID_EXTENSIONS = [ |
||
14 | 'sh', |
||
15 | 'psh' |
||
16 | ]; |
||
17 | |||
18 | /** |
||
19 | * @var ScriptPath[] |
||
20 | */ |
||
21 | private $scriptPaths; |
||
22 | |||
23 | /** |
||
24 | * @var DescriptionReader |
||
25 | */ |
||
26 | private $scriptDescriptionReader; |
||
27 | |||
28 | /** |
||
29 | * @param ScriptPath[] $scriptPaths |
||
30 | * @param DescriptionReader $scriptDescriptionReader |
||
31 | */ |
||
32 | public function __construct(array $scriptPaths, DescriptionReader $scriptDescriptionReader) |
||
37 | |||
38 | /** |
||
39 | * @return Script[] |
||
40 | * @throws ScriptPathNotValidException |
||
41 | */ |
||
42 | public function getAllScripts(): array |
||
72 | |||
73 | /** |
||
74 | * @param string $query |
||
75 | * @return array |
||
76 | */ |
||
77 | public function findScriptsByName(string $query): array |
||
85 | |||
86 | /** |
||
87 | * @param string $scriptName |
||
88 | * @return Script |
||
89 | * @throws ScriptNotFoundException |
||
90 | */ |
||
91 | public function findScriptByName(string $scriptName): Script |
||
101 | } |
||
102 |