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