1 | <?php |
||
12 | class Cell |
||
13 | { |
||
14 | /** |
||
15 | * Numeric cell type (whole numbers, fractional numbers, dates) |
||
16 | */ |
||
17 | const TYPE_NUMERIC = 0; |
||
18 | |||
19 | /** |
||
20 | * String (text) cell type |
||
21 | */ |
||
22 | const TYPE_STRING = 1; |
||
23 | |||
24 | /** |
||
25 | * Formula cell type |
||
26 | * Not used at the moment |
||
27 | */ |
||
28 | const TYPE_FORMULA = 2; |
||
29 | |||
30 | /** |
||
31 | * Empty cell type |
||
32 | */ |
||
33 | const TYPE_EMPTY = 3; |
||
34 | |||
35 | /** |
||
36 | * Boolean cell type |
||
37 | */ |
||
38 | const TYPE_BOOLEAN = 4; |
||
39 | |||
40 | /** |
||
41 | * Error cell type |
||
42 | */ |
||
43 | const TYPE_ERROR = 5; |
||
44 | |||
45 | /** |
||
46 | * The value of this cell |
||
47 | * @var mixed|null |
||
48 | */ |
||
49 | protected $value; |
||
50 | |||
51 | /** |
||
52 | * The cell type |
||
53 | * @var int|null |
||
54 | */ |
||
55 | protected $type; |
||
56 | |||
57 | /** |
||
58 | * The cell style |
||
59 | * @var Style |
||
60 | */ |
||
61 | protected $style; |
||
62 | |||
63 | /** |
||
64 | * @var StyleMerger |
||
65 | */ |
||
66 | protected $styleMerger; |
||
67 | |||
68 | /** |
||
69 | * @param $value mixed |
||
70 | * @param Style|null $style |
||
71 | */ |
||
72 | 87 | public function __construct($value, Style $style = null) |
|
78 | |||
79 | /** |
||
80 | * @param mixed|null $value |
||
81 | */ |
||
82 | 87 | public function setValue($value) |
|
87 | |||
88 | /** |
||
89 | * @return mixed|null |
||
90 | */ |
||
91 | 84 | public function getValue() |
|
95 | |||
96 | /** |
||
97 | * @param Style|null $style |
||
98 | */ |
||
99 | 87 | public function setStyle($style) |
|
103 | |||
104 | /** |
||
105 | * @return Style |
||
106 | */ |
||
107 | 64 | public function getStyle() |
|
111 | |||
112 | /** |
||
113 | * @return int|null |
||
114 | */ |
||
115 | public function getType() |
||
119 | |||
120 | /** |
||
121 | * Get the current value type |
||
122 | * |
||
123 | * @param mixed|null $value |
||
124 | * @return int |
||
125 | */ |
||
126 | 87 | protected function detectType($value) |
|
143 | |||
144 | /** |
||
145 | * @return bool |
||
146 | */ |
||
147 | 11 | public function isBoolean() |
|
151 | |||
152 | /** |
||
153 | * @return bool |
||
154 | */ |
||
155 | 23 | public function isEmpty() |
|
159 | |||
160 | /** |
||
161 | * Not used at the moment |
||
162 | * |
||
163 | * @return bool |
||
164 | */ |
||
165 | public function isFormula() |
||
169 | |||
170 | /** |
||
171 | * @return bool |
||
172 | */ |
||
173 | 10 | public function isNumeric() |
|
177 | |||
178 | /** |
||
179 | * @return bool |
||
180 | */ |
||
181 | 63 | public function isString() |
|
185 | |||
186 | /** |
||
187 | * @return bool |
||
188 | */ |
||
189 | 1 | public function isError() |
|
193 | |||
194 | /** |
||
195 | * @return string |
||
196 | */ |
||
197 | 6 | public function __toString() |
|
201 | } |
||
202 |