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 = null; |
||
50 | |||
51 | /** |
||
52 | * The cell type |
||
53 | * @var int |
||
54 | */ |
||
55 | protected $type = null; |
||
56 | |||
57 | /** |
||
58 | * Cell constructor. |
||
59 | * @param $value mixed |
||
60 | */ |
||
61 | public function __construct($value) |
||
65 | |||
66 | /** |
||
67 | * @param $value mixed |
||
68 | */ |
||
69 | public function setValue($value) |
||
74 | |||
75 | /** |
||
76 | * @return mixed|null |
||
77 | */ |
||
78 | public function getValue() |
||
82 | |||
83 | /** |
||
84 | * @return mixed|null |
||
85 | */ |
||
86 | public function getType() |
||
90 | |||
91 | /** |
||
92 | * Get the current value type |
||
93 | * @return int |
||
94 | */ |
||
95 | protected function detectType($value) |
||
109 | |||
110 | /** |
||
111 | * @return bool |
||
112 | */ |
||
113 | public function isBoolean() |
||
117 | |||
118 | /** |
||
119 | * @return bool |
||
120 | */ |
||
121 | public function isEmpty() |
||
125 | |||
126 | /** |
||
127 | * Not used at the moment |
||
128 | * @return bool |
||
129 | */ |
||
130 | public function isFormula() |
||
134 | |||
135 | /** |
||
136 | * @return bool |
||
137 | */ |
||
138 | public function isNumeric() |
||
142 | |||
143 | /** |
||
144 | * @return bool |
||
145 | */ |
||
146 | public function isString() |
||
150 | |||
151 | /** |
||
152 | * @return bool |
||
153 | */ |
||
154 | public function isError() |
||
158 | |||
159 | /** |
||
160 | * @return string |
||
161 | */ |
||
162 | public function __toString() |
||
166 | } |
||
167 |