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|null |
||
54 | */ |
||
55 | protected $type = null; |
||
56 | |||
57 | /** |
||
58 | * Cell constructor. |
||
59 | * @param $value mixed |
||
60 | */ |
||
61 | 65 | public function __construct($value) |
|
65 | |||
66 | /** |
||
67 | * @param $value mixed|null |
||
68 | */ |
||
69 | 65 | public function setValue($value) |
|
74 | |||
75 | /** |
||
76 | * @return mixed|null |
||
77 | */ |
||
78 | 64 | public function getValue() |
|
82 | |||
83 | /** |
||
84 | * @return int|null |
||
85 | */ |
||
86 | public function getType() |
||
90 | |||
91 | /** |
||
92 | * Get the current value type |
||
93 | * @param mixed|null $value |
||
94 | * @return int |
||
95 | */ |
||
96 | 65 | protected function detectType($value) |
|
110 | |||
111 | /** |
||
112 | * @return bool |
||
113 | */ |
||
114 | 12 | public function isBoolean() |
|
118 | |||
119 | /** |
||
120 | * @return bool |
||
121 | */ |
||
122 | 8 | public function isEmpty() |
|
126 | |||
127 | /** |
||
128 | * Not used at the moment |
||
129 | * @return bool |
||
130 | */ |
||
131 | public function isFormula() |
||
135 | |||
136 | /** |
||
137 | * @return bool |
||
138 | */ |
||
139 | 11 | public function isNumeric() |
|
143 | |||
144 | /** |
||
145 | * @return bool |
||
146 | */ |
||
147 | 64 | public function isString() |
|
151 | |||
152 | /** |
||
153 | * @return bool |
||
154 | */ |
||
155 | public function isError() |
||
159 | |||
160 | /** |
||
161 | * @return string |
||
162 | */ |
||
163 | 1 | public function __toString() |
|
167 | } |
||
168 |