1 | <?php |
||
12 | class TailReader implements ReaderInterface |
||
13 | { |
||
14 | protected $file; |
||
15 | protected $error_file; |
||
16 | protected $handle; |
||
17 | protected $pipes; |
||
18 | protected $process; |
||
19 | |||
20 | 6 | public function configure($file) |
|
21 | { |
||
22 | 6 | if (!file_exists($file)) { |
|
23 | 3 | throw new \RuntimeException("log file is not exists. file:" . $file); |
|
24 | } |
||
25 | 3 | $this->file = $file; |
|
26 | 3 | } |
|
27 | |||
28 | /** |
||
29 | * open stream |
||
30 | */ |
||
31 | 3 | public function open() |
|
44 | |||
45 | /** |
||
46 | * read from stream |
||
47 | * @param null $length |
||
48 | * @return bool|string If there is no more data to read, the process will be blocked |
||
49 | */ |
||
50 | public function read($length = null) |
||
54 | |||
55 | /** |
||
56 | * close stream |
||
57 | * @return mixed |
||
58 | */ |
||
59 | 6 | public function close() |
|
83 | |||
84 | 6 | public function __destruct() |
|
88 | } |
If you suppress an error, we recommend checking for the error condition explicitly: