1 | <?php |
||
13 | class Reader extends AbstractCsv implements \Iterator, \Countable |
||
14 | { |
||
15 | protected $fopenMode = 'r'; |
||
16 | /** @var FormatterInterface[] */ |
||
17 | protected $formatters = []; |
||
18 | /** @var int */ |
||
19 | protected $index = 0; |
||
20 | /** @var Row */ |
||
21 | protected $headers; |
||
22 | /** @var Row */ |
||
23 | protected $row; |
||
24 | /** @var string */ |
||
25 | protected $escapeCharacter = "\0"; |
||
26 | |||
27 | /** |
||
28 | * @param $file |
||
29 | * |
||
30 | * @return array |
||
31 | */ |
||
32 | public static function read($file) |
||
38 | |||
39 | /** |
||
40 | * @return Row |
||
41 | */ |
||
42 | public function getHeaders() |
||
46 | |||
47 | /** |
||
48 | * @param mixed $key |
||
49 | * @param FormatterInterface $formatter |
||
50 | * |
||
51 | * @return $this |
||
52 | */ |
||
53 | public function addFormatter($key, FormatterInterface $formatter) |
||
59 | |||
60 | /** |
||
61 | * @param array|\Traversable $formatters |
||
62 | * |
||
63 | * @return $this |
||
64 | */ |
||
65 | public function addFormatters($formatters) |
||
73 | |||
74 | /** |
||
75 | * @param mixed $key |
||
76 | * |
||
77 | * @return FormatterInterface |
||
78 | */ |
||
79 | public function getFormatter($key) |
||
87 | |||
88 | /** |
||
89 | * @return string |
||
90 | */ |
||
91 | public function getEscapeCharacter() |
||
95 | |||
96 | /** |
||
97 | * @param string $escapeCharacter |
||
98 | * |
||
99 | * @return AbstractCsv |
||
100 | */ |
||
101 | public function setEscapeCharacter($escapeCharacter) |
||
107 | |||
108 | /** |
||
109 | * Returns an array of cells for the next row. |
||
110 | * |
||
111 | * @return Row |
||
112 | */ |
||
113 | protected function getNextRow() |
||
135 | |||
136 | /** |
||
137 | * @inheritDoc |
||
138 | */ |
||
139 | public function current() |
||
143 | |||
144 | /** |
||
145 | * @inheritDoc |
||
146 | */ |
||
147 | public function next() |
||
151 | |||
152 | /** |
||
153 | * @inheritDoc |
||
154 | */ |
||
155 | public function key() |
||
159 | |||
160 | /** |
||
161 | * @inheritDoc |
||
162 | */ |
||
163 | public function valid() |
||
169 | |||
170 | /** |
||
171 | * @inheritDoc |
||
172 | */ |
||
173 | public function rewind() |
||
185 | |||
186 | /** |
||
187 | * @inheritDoc |
||
188 | */ |
||
189 | public function count() |
||
193 | } |
||
194 |