1 | <?php |
||
11 | class Cell |
||
12 | { |
||
13 | /** |
||
14 | * Numeric cell type (whole numbers, fractional numbers, dates) |
||
15 | */ |
||
16 | const TYPE_NUMERIC = 0; |
||
17 | |||
18 | /** |
||
19 | * String (text) cell type |
||
20 | */ |
||
21 | const TYPE_STRING = 1; |
||
22 | |||
23 | /** |
||
24 | * Formula cell type |
||
25 | * Not used at the moment |
||
26 | */ |
||
27 | const TYPE_FORMULA = 2; |
||
28 | |||
29 | /** |
||
30 | * Empty cell type |
||
31 | */ |
||
32 | const TYPE_EMPTY = 3; |
||
33 | |||
34 | /** |
||
35 | * Boolean cell type |
||
36 | */ |
||
37 | const TYPE_BOOLEAN = 4; |
||
38 | |||
39 | /** |
||
40 | * Error cell type |
||
41 | */ |
||
42 | const TYPE_ERROR = 5; |
||
43 | |||
44 | /** |
||
45 | * The value of this cell |
||
46 | * @var mixed|null |
||
47 | */ |
||
48 | protected $value; |
||
49 | |||
50 | /** |
||
51 | * The cell type |
||
52 | * @var int|null |
||
53 | */ |
||
54 | protected $type; |
||
55 | |||
56 | /** |
||
57 | * The cell style |
||
58 | * @var Style |
||
59 | */ |
||
60 | protected $style; |
||
61 | |||
62 | /** |
||
63 | * @param $value mixed |
||
64 | * @param Style|null $style |
||
65 | */ |
||
66 | 90 | public function __construct($value, Style $style = null) |
|
71 | |||
72 | /** |
||
73 | * @param mixed|null $value |
||
74 | */ |
||
75 | 90 | public function setValue($value) |
|
80 | |||
81 | /** |
||
82 | * @return mixed|null |
||
83 | */ |
||
84 | 87 | public function getValue() |
|
88 | |||
89 | /** |
||
90 | * @param Style|null $style |
||
91 | */ |
||
92 | 90 | public function setStyle($style) |
|
96 | |||
97 | /** |
||
98 | * @return Style |
||
99 | */ |
||
100 | 66 | public function getStyle() |
|
104 | |||
105 | /** |
||
106 | * @return int|null |
||
107 | */ |
||
108 | public function getType() |
||
112 | |||
113 | /** |
||
114 | * Get the current value type |
||
115 | * |
||
116 | * @param mixed|null $value |
||
117 | * @return int |
||
118 | */ |
||
119 | 90 | protected function detectType($value) |
|
136 | |||
137 | /** |
||
138 | * @return bool |
||
139 | */ |
||
140 | 11 | public function isBoolean() |
|
144 | |||
145 | /** |
||
146 | * @return bool |
||
147 | */ |
||
148 | 23 | public function isEmpty() |
|
152 | |||
153 | /** |
||
154 | * Not used at the moment |
||
155 | * |
||
156 | * @return bool |
||
157 | */ |
||
158 | public function isFormula() |
||
162 | |||
163 | /** |
||
164 | * @return bool |
||
165 | */ |
||
166 | 10 | public function isNumeric() |
|
170 | |||
171 | /** |
||
172 | * @return bool |
||
173 | */ |
||
174 | 65 | public function isString() |
|
178 | |||
179 | /** |
||
180 | * @return bool |
||
181 | */ |
||
182 | 1 | public function isError() |
|
186 | |||
187 | /** |
||
188 | * @return string |
||
189 | */ |
||
190 | 7 | public function __toString() |
|
194 | } |
||
195 |