1 | <?php |
||
22 | class CsvFormatter implements FormatterInterface |
||
23 | { |
||
24 | use RowProcessor; |
||
25 | use InvokeFormatter; |
||
26 | |||
27 | /** |
||
28 | * @var CsvFormatInterface |
||
29 | */ |
||
30 | private $csvFormat; |
||
31 | |||
32 | /** |
||
33 | * @var string[] |
||
34 | */ |
||
35 | private $escapeChars; |
||
36 | |||
37 | /** |
||
38 | * @var string[] |
||
39 | */ |
||
40 | private $replaceChars; |
||
41 | |||
42 | /** |
||
43 | * @param CsvFormatInterface $csvFormat |
||
44 | */ |
||
45 | 14 | public function __construct(CsvFormatInterface $csvFormat) |
|
77 | |||
78 | /** |
||
79 | * @param array $data |
||
80 | * |
||
81 | * @return string |
||
82 | */ |
||
83 | 11 | public function format(array $data) |
|
97 | |||
98 | /** |
||
99 | * @param string $string |
||
100 | * |
||
101 | * @return string |
||
102 | */ |
||
103 | 11 | protected function escape($string) |
|
107 | |||
108 | /** |
||
109 | * Return an initial block if required |
||
110 | * |
||
111 | * @return string |
||
112 | */ |
||
113 | 4 | public function getInitialBlock() |
|
117 | |||
118 | /** |
||
119 | * Get a separator between each row |
||
120 | * |
||
121 | * @return string |
||
122 | */ |
||
123 | 4 | public function getRowSeparator() |
|
127 | |||
128 | /** |
||
129 | * Return a closing block if required |
||
130 | * |
||
131 | * @return string |
||
132 | */ |
||
133 | 4 | public function getClosingBlock() |
|
137 | } |
||
138 |