Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php namespace Arcanesoft\Tracker\Support; |
||
29 | public static function getCurrentMonthDaysRange($keyFormat = 'Y-m-d', $interval = '1 day') |
||
30 | { |
||
31 | $start = Carbon::now()->subMonth(1)->setTime(0, 0); |
||
32 | $end = Carbon::now()->setTime(23, 59, 59); |
||
33 | |||
34 | $range = new Collection; |
||
35 | |||
36 | /** @var \Carbon\Carbon $period */ |
||
37 | foreach (new DatePeriod($start, DateInterval::createFromDateString($interval), $end) as $period) { |
||
38 | $range->put($period->format($keyFormat), $period); |
||
39 | } |
||
40 | |||
41 | return compact('start', 'end', 'range'); |
||
42 | } |
||
43 | } |
||
44 |