1 | <?php |
||
17 | class File implements WatcherInterface |
||
18 | { |
||
19 | /** |
||
20 | * File path. |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $file; |
||
25 | |||
26 | /** |
||
27 | * @param string|array|null $files |
||
28 | */ |
||
29 | public function __construct($files = null) |
||
30 | { |
||
31 | if (!is_array($files)) { |
||
32 | $files = [$files]; |
||
33 | } |
||
34 | |||
35 | foreach ($files as $file) { |
||
36 | $this->addFile($file); |
||
37 | } |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * Add file path. |
||
42 | * |
||
43 | * @param string $file |
||
44 | * |
||
45 | * @return $this |
||
46 | */ |
||
47 | public function addFile($file) |
||
48 | { |
||
49 | if (trim($file) !== '') { |
||
50 | $this->file = realpath(trim($file)); |
||
51 | } |
||
52 | |||
53 | return $this; |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | public function isActive() |
||
63 | } |
||
64 |