| Conditions | 4 |
| Paths | 6 |
| Total Lines | 22 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 4.343 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 33 | 1 | public function createYearsFrom($startYear, $endYear = null) |
|
| 34 | { |
||
| 35 | 1 | $result = []; |
|
| 36 | 1 | if (is_null($endYear)) { |
|
| 37 | $endYear = date('Y'); |
||
| 38 | } |
||
| 39 | |||
| 40 | 1 | for ($year = $startYear; $year <= $endYear; ++$year) { |
|
| 41 | 1 | $obdobi = ['kod' => $year, |
|
| 42 | 1 | 'platiOdData' => $year.'-01-01T00:00:00', |
|
| 43 | 1 | 'platiDoData' => $year.'-12-31T23:59:59', |
|
| 44 | 1 | ]; |
|
| 45 | 1 | if ($this->idExists('code:'.$year)) { |
|
|
|
|||
| 46 | 1 | $this->addStatusMessage(sprintf(_('%s already exists.'), $year)); |
|
| 47 | 1 | } else { |
|
| 48 | $this->setData($obdobi); |
||
| 49 | $result[] = $this->insertToFlexibee(); |
||
| 50 | $this->dataReset(); |
||
| 51 | } |
||
| 52 | 1 | } |
|
| 53 | 1 | return $result; |
|
| 54 | } |
||
| 55 | } |
||
| 56 |
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: