1 | <?php |
||
10 | class Cell |
||
11 | { |
||
12 | /** |
||
13 | * Numeric cell type (whole numbers, fractional numbers, dates) |
||
14 | */ |
||
15 | const TYPE_NUMERIC = 0; |
||
16 | |||
17 | /** |
||
18 | * String (text) cell type |
||
19 | */ |
||
20 | const TYPE_STRING = 1; |
||
21 | |||
22 | /** |
||
23 | * Formula cell type |
||
24 | * Not used at the moment |
||
25 | */ |
||
26 | const TYPE_FORMULA = 2; |
||
27 | |||
28 | /** |
||
29 | * Empty cell type |
||
30 | */ |
||
31 | const TYPE_EMPTY = 3; |
||
32 | |||
33 | /** |
||
34 | * Boolean cell type |
||
35 | */ |
||
36 | const TYPE_BOOLEAN = 4; |
||
37 | |||
38 | /** |
||
39 | * Error cell type |
||
40 | */ |
||
41 | const TYPE_ERROR = 5; |
||
42 | |||
43 | /** |
||
44 | * The value of this cell |
||
45 | * @var mixed|null |
||
46 | */ |
||
47 | protected $value; |
||
48 | |||
49 | /** |
||
50 | * The cell type |
||
51 | * @var int|null |
||
52 | */ |
||
53 | protected $type; |
||
54 | |||
55 | /** |
||
56 | * @param $value mixed |
||
57 | */ |
||
58 | 24 | public function __construct($value) |
|
62 | |||
63 | /** |
||
64 | * @param mixed|null $value |
||
65 | */ |
||
66 | 24 | public function setValue($value) |
|
71 | |||
72 | /** |
||
73 | * @return mixed|null |
||
74 | */ |
||
75 | 24 | public function getValue() |
|
79 | |||
80 | /** |
||
81 | * @return int|null |
||
82 | */ |
||
83 | public function getType() |
||
87 | |||
88 | /** |
||
89 | * Get the current value type |
||
90 | * |
||
91 | * @param mixed|null $value |
||
92 | * @return int |
||
93 | */ |
||
94 | 24 | protected function detectType($value) |
|
111 | |||
112 | /** |
||
113 | * @return bool |
||
114 | */ |
||
115 | public function isBoolean() |
||
119 | |||
120 | /** |
||
121 | * @return bool |
||
122 | */ |
||
123 | public function isEmpty() |
||
127 | |||
128 | /** |
||
129 | * Not used at the moment |
||
130 | * |
||
131 | * @return bool |
||
132 | */ |
||
133 | public function isFormula() |
||
137 | |||
138 | /** |
||
139 | * @return bool |
||
140 | */ |
||
141 | public function isNumeric() |
||
145 | |||
146 | /** |
||
147 | * @return bool |
||
148 | */ |
||
149 | public function isString() |
||
153 | |||
154 | /** |
||
155 | * @return bool |
||
156 | */ |
||
157 | public function isError() |
||
161 | |||
162 | /** |
||
163 | * @return string |
||
164 | */ |
||
165 | public function __toString() |
||
169 | } |
||
170 |