| Conditions | 4 |
| Paths | 6 |
| Total Lines | 22 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 4 |
| 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 | 1 | $endYear = date('Y'); |
|
| 38 | } |
||
| 39 | 1 | ||
| 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 | 1 | $this->setData($obdobi); |
|
| 49 | $result[] = $this->insertToFlexibee(); |
||
| 50 | $this->dataReset(); |
||
| 51 | } |
||
| 52 | } |
||
| 53 | return $result; |
||
| 54 | } |
||
| 55 | } |
||
| 56 |