Conditions | 3 |
Paths | 4 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
27 | public function getPrepaidQuantity() |
||
28 | { |
||
29 | if ($this->getCpuUnit() === self::UNIT_CORE) { |
||
30 | preg_match('/((\d+) cores?)$/i', $this->resource->part->partno, $matches); |
||
31 | } else { |
||
32 | preg_match('/((\d+) MHz)$/i', $this->resource->part->partno, $matches); |
||
33 | |||
34 | } |
||
35 | |||
36 | return $matches[2] === null ? 0 : $matches[2]; |
||
37 | } |
||
38 | |||
48 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: