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|null |
||
60 | */ |
||
61 | protected $style; |
||
62 | |||
63 | /** |
||
64 | * @var StyleMerger |
||
65 | */ |
||
66 | protected $styleMerger; |
||
67 | |||
68 | /** |
||
69 | * Cell constructor. |
||
70 | * @param $value mixed |
||
71 | * @param $style|null Style |
||
72 | */ |
||
73 | 97 | public function __construct($value, Style $style = null) |
|
74 | { |
||
75 | 97 | $this->setValue($value); |
|
76 | 97 | $this->setStyle($style); |
|
77 | 97 | $this->styleMerger = new StyleMerger(); |
|
78 | 97 | } |
|
79 | |||
80 | /** |
||
81 | * @param $value mixed|null |
||
82 | */ |
||
83 | 97 | public function setValue($value) |
|
84 | { |
||
85 | 97 | $this->value = $value; |
|
86 | 97 | $this->type = $this->detectType($value); |
|
87 | 97 | } |
|
88 | |||
89 | /** |
||
90 | * @return mixed|null |
||
91 | */ |
||
92 | 94 | public function getValue() |
|
93 | { |
||
94 | 94 | return $this->value; |
|
95 | } |
||
96 | |||
97 | /** |
||
98 | * @param Style $style|null |
||
|
|||
99 | */ |
||
100 | 97 | public function setStyle(Style $style = null) |
|
104 | |||
105 | /** |
||
106 | * @return Style|null |
||
107 | */ |
||
108 | 63 | public function getStyle() |
|
116 | |||
117 | /** |
||
118 | * @return int|null |
||
119 | */ |
||
120 | public function getType() |
||
124 | |||
125 | /** |
||
126 | * Get the current value type |
||
127 | * @param mixed|null $value |
||
128 | * @return int |
||
129 | */ |
||
130 | 97 | protected function detectType($value) |
|
147 | |||
148 | /** |
||
149 | * @return bool |
||
150 | */ |
||
151 | 11 | public function isBoolean() |
|
155 | |||
156 | /** |
||
157 | * @return bool |
||
158 | */ |
||
159 | 30 | public function isEmpty() |
|
163 | |||
164 | /** |
||
165 | * Not used at the moment |
||
166 | * @return bool |
||
167 | */ |
||
168 | public function isFormula() |
||
172 | |||
173 | /** |
||
174 | * @return bool |
||
175 | */ |
||
176 | 10 | public function isNumeric() |
|
180 | |||
181 | /** |
||
182 | * @return bool |
||
183 | */ |
||
184 | 64 | public function isString() |
|
188 | |||
189 | /** |
||
190 | * @return bool |
||
191 | */ |
||
192 | 1 | public function isError() |
|
196 | |||
197 | /** |
||
198 | * @return string |
||
199 | */ |
||
200 | 8 | public function __toString() |
|
204 | |||
205 | /** |
||
206 | * @param Style $style|null |
||
207 | * @return Cell |
||
208 | */ |
||
209 | 61 | public function applyStyle(Style $style = null) |
|
219 | } |
||
220 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.