Conditions | 2 |
Paths | 2 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
10 | public static function create(array $options = []): array |
||
11 | { |
||
12 | $options = static::mergeWithDefaultOptions($options); |
||
13 | |||
14 | if (empty($options['watch']['directories'])) { |
||
15 | throw new InvalidArgumentException( |
||
16 | 'The watch directories do not exist. Make sure you are running the watcher from '. |
||
17 | 'the root of your project, or create a custom config file.' |
||
18 | ); |
||
19 | } |
||
20 | |||
21 | $finder = (new Finder()) |
||
22 | ->ignoreDotFiles(false) |
||
23 | ->ignoreVCS(false) |
||
24 | ->name($options['watch']['fileMask']) |
||
25 | ->files() |
||
26 | ->in($options['watch']['directories']); |
||
27 | |||
28 | $watcher = new Watcher($finder, $options); |
||
29 | |||
30 | return [$watcher, $options]; |
||
31 | } |
||
32 | |||
63 |