1 | <?php |
||
29 | trait IsReadable |
||
30 | { |
||
31 | /** |
||
32 | * Read single line. |
||
33 | * Read the next line from the file (moving the internal pointer down a line). |
||
34 | * Returns multiple lines if newline character(s) fall within a quoted string. |
||
35 | * |
||
36 | * @param string|array A string or array of strings to be used as EOL char/sequence |
||
37 | * @param int Maximum number of bytes to return (line will be truncated to this -1 if set) |
||
38 | * @return string A single line read from the file. |
||
39 | * @throws CSVelte\Exception\IOException |
||
40 | * @todo Should this add a newline if maxlength is reached? |
||
41 | * @todo I could actually buffer this by reading x chars at a time and doing |
||
42 | * the same thing with looping char by char if this is too IO intensive. |
||
43 | */ |
||
44 | 19 | public function readLine($eol = PHP_EOL, $maxLength = null) |
|
68 | |||
69 | /** |
||
70 | * Assert that this file/stream object is readable. |
||
71 | * |
||
72 | * @return void |
||
73 | * @throws CSVelte\Exception\IOException if stream isn't readable |
||
74 | */ |
||
75 | 24 | protected function assertIsReadable() |
|
81 | |||
82 | abstract public function getName(); |
||
83 | |||
84 | abstract public function isReadable(); |
||
85 | |||
86 | abstract public function read($length); |
||
87 | |||
88 | abstract public function eof(); |
||
89 | |||
90 | } |
||
91 |