1 | <?php |
||
16 | class Excel2003XmlWriter extends FileWriter |
||
17 | { |
||
18 | /** @const string */ |
||
19 | const COLUMN_XML = '<Column ss:Span="1" ss:Width="64"/>'; |
||
20 | |||
21 | /** @var EncoderInterface */ |
||
22 | protected $encoder; |
||
23 | |||
24 | /** @var string */ |
||
25 | protected $format; |
||
26 | |||
27 | /** @var string */ |
||
28 | protected $headerTemplate; |
||
29 | |||
30 | /** @var string */ |
||
31 | protected $footerTemplate; |
||
32 | |||
33 | /** |
||
34 | * @var string |
||
35 | * @Assert\NotBlank(groups={"Execution"}) |
||
36 | */ |
||
37 | protected $filePath = '/tmp/export_%datetime%.xml'; |
||
38 | |||
39 | /** @var array */ |
||
40 | protected $labels; |
||
41 | |||
42 | /** @var int */ |
||
43 | protected $tempHandler; |
||
44 | |||
45 | /** @var int */ |
||
46 | protected $handler; |
||
47 | |||
48 | /** |
||
49 | * @param EncoderInterface $encoder |
||
50 | * @param string $format |
||
51 | * @param string $headerTemplate |
||
52 | * @param string $footerTemplate |
||
53 | */ |
||
54 | public function __construct(EncoderInterface $encoder, $format, $headerTemplate, $footerTemplate) |
||
61 | |||
62 | /** |
||
63 | * {@inheritdoc} |
||
64 | */ |
||
65 | public function write(array $items) |
||
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | public function initialize() |
||
80 | |||
81 | /** |
||
82 | * {@inheritdoc} |
||
83 | */ |
||
84 | public function flush() |
||
96 | |||
97 | /** |
||
98 | * Writes an item |
||
99 | * |
||
100 | * @param array $item |
||
101 | */ |
||
102 | protected function writeItem(array $item) |
||
126 | |||
127 | /** |
||
128 | * Returns the context for an encoder |
||
129 | * |
||
130 | * @param array $item |
||
131 | * |
||
132 | * @return array |
||
133 | */ |
||
134 | protected function getContext(array $item) |
||
138 | |||
139 | /** |
||
140 | * Writes the header of the XML file |
||
141 | */ |
||
142 | protected function writeHeader() |
||
146 | |||
147 | /** |
||
148 | * Writes the footer of the XML file |
||
149 | */ |
||
150 | protected function writeFooter() |
||
154 | |||
155 | /** |
||
156 | * Writes the Columns section of the XML file |
||
157 | * |
||
158 | * @return null |
||
159 | */ |
||
160 | protected function writeColumns() |
||
168 | |||
169 | /** |
||
170 | * Writes the labels row of the XML file |
||
171 | */ |
||
172 | protected function writeLabels() |
||
176 | |||
177 | /** |
||
178 | * Appends the contents of a file to the XML file |
||
179 | * |
||
180 | * @param string $fileName |
||
181 | */ |
||
182 | protected function appendFile($fileName) |
||
188 | } |
||
189 |