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