1
|
|
|
<?php |
2
|
|
|
namespace Ellumilel; |
3
|
|
|
|
4
|
|
|
/** |
5
|
|
|
* Class Sheet |
6
|
|
|
* @package Ellumilel |
7
|
|
|
* @author Denis Tikhonov <[email protected]> |
8
|
|
|
*/ |
9
|
|
|
class Sheet |
10
|
|
|
{ |
11
|
|
|
/** @var string */ |
12
|
|
|
private $filename; |
13
|
|
|
/** @var string */ |
14
|
|
|
private $sheetName; |
15
|
|
|
/** @var string */ |
16
|
|
|
private $xmlName; |
17
|
|
|
/** @var int */ |
18
|
|
|
private $rowCount = 0; |
19
|
|
|
/** @var Writer */ |
20
|
|
|
private $writer; |
21
|
|
|
/** @var array */ |
22
|
|
|
private $columns = []; |
23
|
|
|
/** @var array */ |
24
|
|
|
private $mergeCells = []; |
25
|
|
|
/** @var int */ |
26
|
|
|
private $maxCellTagStart = 0; |
27
|
|
|
/** @var int */ |
28
|
|
|
private $maxCellTagEnd = 0; |
29
|
|
|
/** @var bool */ |
30
|
|
|
private $finalized = false; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @return string |
34
|
|
|
*/ |
35
|
|
|
public function getFilename() |
36
|
|
|
{ |
37
|
|
|
return $this->filename; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @param string $filename |
42
|
|
|
* |
43
|
|
|
* @return $this |
44
|
|
|
*/ |
45
|
|
|
public function setFilename($filename) |
46
|
|
|
{ |
47
|
|
|
$this->filename = $filename; |
48
|
|
|
|
49
|
|
|
return $this; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @return string |
54
|
|
|
*/ |
55
|
|
|
public function getSheetName() |
56
|
|
|
{ |
57
|
|
|
return $this->sheetName; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @param string $sheetName |
62
|
|
|
* |
63
|
|
|
* @return $this |
64
|
|
|
*/ |
65
|
|
|
public function setSheetName($sheetName) |
66
|
|
|
{ |
67
|
|
|
$this->sheetName = $sheetName; |
68
|
|
|
|
69
|
|
|
return $this; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @return string |
74
|
|
|
*/ |
75
|
|
|
public function getXmlName() |
76
|
|
|
{ |
77
|
|
|
return $this->xmlName; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @param string $xmlName |
82
|
|
|
* |
83
|
|
|
* @return $this |
84
|
|
|
*/ |
85
|
|
|
public function setXmlName($xmlName) |
86
|
|
|
{ |
87
|
|
|
$this->xmlName = $xmlName; |
88
|
|
|
|
89
|
|
|
return $this; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @return int |
94
|
|
|
*/ |
95
|
|
|
public function getRowCount() |
96
|
|
|
{ |
97
|
|
|
return $this->rowCount; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @param int $rowCount |
102
|
|
|
* |
103
|
|
|
* @return $this |
104
|
|
|
*/ |
105
|
|
|
public function setRowCount($rowCount) |
106
|
|
|
{ |
107
|
|
|
$this->rowCount = $rowCount; |
108
|
|
|
|
109
|
|
|
return $this; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @return int |
114
|
|
|
*/ |
115
|
|
|
public function increaseRowCount() |
116
|
|
|
{ |
117
|
|
|
return $this->rowCount++; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @return Writer |
122
|
|
|
*/ |
123
|
|
|
public function getWriter() |
124
|
|
|
{ |
125
|
|
|
return $this->writer; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @param Writer $writer |
130
|
|
|
* |
131
|
|
|
* @return $this |
132
|
|
|
*/ |
133
|
|
|
public function setWriter(Writer $writer) |
134
|
|
|
{ |
135
|
|
|
$this->writer = $writer; |
136
|
|
|
|
137
|
|
|
return $this; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @return array |
142
|
|
|
*/ |
143
|
|
|
public function getColumns() |
144
|
|
|
{ |
145
|
|
|
return $this->columns; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* @param int $column |
150
|
|
|
* |
151
|
|
|
* @return $this |
152
|
|
|
*/ |
153
|
|
|
public function setColumn($column) |
154
|
|
|
{ |
155
|
|
|
$this->columns[] = $column; |
156
|
|
|
|
157
|
|
|
return $this; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* @param array $columns |
162
|
|
|
* |
163
|
|
|
* @return $this |
164
|
|
|
*/ |
165
|
|
|
public function setColumns(array $columns) |
166
|
|
|
{ |
167
|
|
|
$this->columns = $columns; |
168
|
|
|
|
169
|
|
|
return $this; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* @return array |
174
|
|
|
*/ |
175
|
|
|
public function getMergeCells() |
176
|
|
|
{ |
177
|
|
|
return $this->mergeCells; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* @param string $mergeCells |
182
|
|
|
* |
183
|
|
|
* @return $this |
184
|
|
|
*/ |
185
|
|
|
public function setMergeCells($mergeCells) |
186
|
|
|
{ |
187
|
|
|
$this->mergeCells[] = $mergeCells; |
188
|
|
|
|
189
|
|
|
return $this; |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* @return int |
194
|
|
|
*/ |
195
|
|
|
public function getMaxCellTagStart() |
196
|
|
|
{ |
197
|
|
|
return $this->maxCellTagStart; |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* @param int $maxCellTagStart |
202
|
|
|
* |
203
|
|
|
* @return $this |
204
|
|
|
*/ |
205
|
|
|
public function setMaxCellTagStart($maxCellTagStart) |
206
|
|
|
{ |
207
|
|
|
$this->maxCellTagStart = $maxCellTagStart; |
208
|
|
|
|
209
|
|
|
return $this; |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* @return int |
214
|
|
|
*/ |
215
|
|
|
public function getMaxCellTagEnd() |
216
|
|
|
{ |
217
|
|
|
return $this->maxCellTagEnd; |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* @param int $maxCellTagEnd |
222
|
|
|
* |
223
|
|
|
* @return $this |
224
|
|
|
*/ |
225
|
|
|
public function setMaxCellTagEnd($maxCellTagEnd) |
226
|
|
|
{ |
227
|
|
|
$this->maxCellTagEnd = $maxCellTagEnd; |
228
|
|
|
|
229
|
|
|
return $this; |
230
|
|
|
} |
231
|
|
|
|
232
|
|
|
/** |
233
|
|
|
* @return bool |
234
|
|
|
*/ |
235
|
|
|
public function getFinalized() |
236
|
|
|
{ |
237
|
|
|
return $this->finalized; |
238
|
|
|
} |
239
|
|
|
|
240
|
|
|
/** |
241
|
|
|
* @param bool $finalized |
242
|
|
|
* |
243
|
|
|
* @return $this |
244
|
|
|
*/ |
245
|
|
|
public function setFinalized($finalized) |
246
|
|
|
{ |
247
|
|
|
$this->finalized = $finalized; |
248
|
|
|
|
249
|
|
|
return $this; |
250
|
|
|
} |
251
|
|
|
} |
252
|
|
|
|