1 | <?php |
||
8 | class Stream implements ReaderInterface |
||
9 | { |
||
10 | /** |
||
11 | * @var string $filename The name of the file this stream represents. |
||
12 | */ |
||
13 | private $filename; |
||
14 | |||
15 | /** |
||
16 | * @var resource $resource The underlying stream this object represents. |
||
17 | */ |
||
18 | private $resource; |
||
19 | |||
20 | |||
21 | /** |
||
22 | * Create a new instance. |
||
23 | * |
||
24 | * @param string $filename The name of the file this stream represents |
||
25 | */ |
||
26 | 16 | public function __construct($filename) |
|
30 | |||
31 | |||
32 | /** |
||
33 | * Read a line from the stream |
||
34 | * |
||
35 | * @return string |
||
36 | */ |
||
37 | 8 | public function line() |
|
41 | |||
42 | |||
43 | /** |
||
44 | * Read from the stream until EOF (^D) is reached |
||
45 | * |
||
46 | * @return string |
||
47 | */ |
||
48 | 8 | public function multiLine() |
|
52 | |||
53 | |||
54 | /** |
||
55 | * Read one character |
||
56 | * |
||
57 | * @param int $count |
||
58 | * |
||
59 | * @return string |
||
60 | */ |
||
61 | 4 | public function char($count = 1) |
|
65 | |||
66 | |||
67 | /** |
||
68 | * Read the line, but hide what the user is typing |
||
69 | * |
||
70 | * @return string |
||
71 | */ |
||
72 | public function hidden() |
||
76 | |||
77 | |||
78 | /** |
||
79 | * Return a valid resource, even if it previously EOF'ed. |
||
80 | * |
||
81 | * @return resource |
||
82 | */ |
||
83 | 16 | private function getResource() |
|
100 | } |
||
101 |