1 | <?php |
||
15 | class Writer extends WriterAbstract |
||
16 | { |
||
17 | /** Number of rows to write before flushing */ |
||
18 | const FLUSH_THRESHOLD = 500; |
||
19 | |||
20 | /** @var string Content-Type value for the header */ |
||
21 | protected static $headerContentType = 'text/csv; charset=UTF-8'; |
||
22 | |||
23 | /** @var int */ |
||
24 | protected $lastWrittenRowIndex = 0; |
||
25 | |||
26 | /** |
||
27 | * Sets the field delimiter for the CSV |
||
28 | * |
||
29 | * @param string $fieldDelimiter Character that delimits fields |
||
30 | * @return Writer |
||
31 | */ |
||
32 | 7 | public function setFieldDelimiter($fieldDelimiter) |
|
38 | |||
39 | /** |
||
40 | * Sets the field enclosure for the CSV |
||
41 | * |
||
42 | * @param string $fieldEnclosure Character that enclose fields |
||
43 | * @return Writer |
||
44 | */ |
||
45 | 7 | public function setFieldEnclosure($fieldEnclosure) |
|
51 | |||
52 | /** |
||
53 | * Set if a BOM has to be added to the file |
||
54 | * |
||
55 | * @param bool $shouldAddBOM |
||
56 | * @return Writer |
||
57 | */ |
||
58 | 7 | public function setShouldAddBOM($shouldAddBOM) |
|
64 | |||
65 | /** |
||
66 | * Opens the CSV streamer and makes it ready to accept data. |
||
67 | * |
||
68 | * @return void |
||
69 | */ |
||
70 | 7 | protected function openWriter() |
|
77 | |||
78 | /** |
||
79 | * Adds a row to the currently opened writer. |
||
80 | * |
||
81 | * @param Row $row The row containing cells and styles |
||
82 | * @throws IOException If unable to write data |
||
83 | * @return void |
||
84 | */ |
||
85 | 7 | protected function addRowToWriter(Row $row) |
|
100 | |||
101 | /** |
||
102 | * Closes the CSV streamer, preventing any additional writing. |
||
103 | * If set, sets the headers and redirects output to the browser. |
||
104 | * |
||
105 | * @return void |
||
106 | */ |
||
107 | 7 | protected function closeWriter() |
|
111 | } |
||
112 |