1 | <?php |
||
7 | class BIFFwriter |
||
8 | { |
||
9 | /** |
||
10 | * This flag indicates write to temporary buffer mode |
||
11 | * instead of $data |
||
12 | * @var bool |
||
13 | */ |
||
14 | protected $bufferedWrite = false; |
||
15 | |||
16 | /** |
||
17 | * Temporary buffer |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $buffer = ''; |
||
21 | |||
22 | /** |
||
23 | * The string containing the data of the BIFF stream |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $data = ''; |
||
27 | |||
28 | /** |
||
29 | * The size of the data in bytes. Should be the same as strlen($this->data) |
||
30 | * But this is not true for Worksheet, cause it writes directly to file |
||
31 | * @var integer |
||
32 | */ |
||
33 | protected $datasize = 0; |
||
34 | |||
35 | /** |
||
36 | * @param $data |
||
37 | * |
||
38 | * @return string |
||
39 | */ |
||
40 | protected function addContinueIfNeeded($data) |
||
48 | |||
49 | /** |
||
50 | * @param string $data binary data to append |
||
51 | */ |
||
52 | protected function append($data) |
||
57 | |||
58 | /** |
||
59 | * @param string $data binary data to append |
||
60 | */ |
||
61 | protected function appendRaw($data) |
||
70 | |||
71 | /** |
||
72 | * @param string $type |
||
73 | * @param array $params |
||
74 | */ |
||
75 | protected function appendRecord($type, array $params = array()) |
||
79 | |||
80 | /** |
||
81 | * This function takes a long BIFF record and inserts CONTINUE records as |
||
82 | * necessary. |
||
83 | * |
||
84 | * @param string $data The original binary data to be written |
||
85 | * @return string Сonvenient string of continue blocks |
||
86 | */ |
||
87 | protected function addContinue($data) |
||
91 | |||
92 | /** |
||
93 | * @return int |
||
94 | */ |
||
95 | public function getDataSize() |
||
99 | |||
100 | /** |
||
101 | * @param string $type |
||
102 | * @param array $params |
||
103 | * |
||
104 | * @return mixed |
||
105 | */ |
||
106 | protected function getRecord($type, array $params = array()) |
||
112 | |||
113 | /** |
||
114 | * @param $type |
||
115 | * |
||
116 | * @return AbstractRecord |
||
117 | */ |
||
118 | protected function createRecord($type) |
||
123 | |||
124 | protected function isBufferedWriteOn() |
||
128 | |||
129 | protected function startBufferedWrite() |
||
134 | |||
135 | protected function endBufferedWrite() |
||
139 | |||
140 | protected function getBuffer() |
||
144 | |||
145 | protected function getBufferSize() |
||
149 | |||
150 | /** |
||
151 | * @return string |
||
152 | */ |
||
153 | protected function getDataAndFlush() |
||
161 | } |
||
162 |