1 | <?php |
||
8 | class Writer extends AbstractCsv |
||
9 | { |
||
10 | /** @var string */ |
||
11 | protected $openMode = 'w+'; |
||
12 | |||
13 | public static function write($file, $data) |
||
19 | |||
20 | /** |
||
21 | * Sets headers and all rows on the CSV file and |
||
22 | * then closes the file handle. |
||
23 | * |
||
24 | * @param $data |
||
25 | * |
||
26 | * @return $this |
||
27 | */ |
||
28 | public function setData($data) |
||
38 | |||
39 | /** |
||
40 | * @param array $headers |
||
41 | * |
||
42 | * @return $this |
||
43 | */ |
||
44 | public function setHeaders(array $headers) |
||
52 | |||
53 | /** |
||
54 | * Adds multiple rows of data to the CSV file. |
||
55 | * |
||
56 | * @param array $rows |
||
57 | */ |
||
58 | public function addRows($rows) |
||
64 | |||
65 | /** |
||
66 | * Adds a row of data to the CSV file. |
||
67 | * |
||
68 | * @param array $row Row of data to add to the file. |
||
69 | * |
||
70 | * @return bool Whether the row was written to the file. |
||
71 | */ |
||
72 | public function addRow($row) |
||
83 | } |
||
84 |