| Conditions | 1 |
| Paths | 1 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 1 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 37 | 3 | public function getSeconds() |
|
| 38 | { |
||
| 39 | // interval duration [next month, next month +1) |
||
| 40 | 3 | $offset_time = clone $this->time; |
|
| 41 | 3 | $offset_time->modify('+1 month 00:00:00')->modify('first day of this month'); |
|
| 42 | |||
| 43 | 3 | $limit_time = clone $this->time; |
|
| 44 | 3 | $limit_time->modify('+2 month 00:00:00')->modify('first day of this month'); |
|
| 45 | 3 | $limit = $limit_time->getTimestamp() - $offset_time->getTimestamp(); |
|
| 46 | |||
| 47 | // offset to next month |
||
| 48 | 3 | $offset_time = clone $this->time; |
|
| 49 | 3 | $offset_time->modify('+1 month 00:00:00')->modify('first day of this month'); |
|
| 50 | 3 | $offset = $offset_time->getTimestamp() - $this->time->getTimestamp(); |
|
| 51 | |||
| 52 | 3 | return $offset + rand(0, $limit); |
|
| 53 | } |
||
| 54 | } |
||
| 55 |