DateService::getTomorrow()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 7
cts 7
cp 1
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Firesphere\PartialUserforms\Services;
4
5
use DateInterval;
6
use DateTime;
7
use Exception;
8
use SilverStripe\ORM\FieldType\DBDatetime;
9
10
class DateService
11
{
12
13
    /**
14
     * @return DBDatetime
15
     * @throws Exception
16
     */
17 14
    public static function getTomorrow()
18
    {
19 14
        $dateTime = new DateTime(DBDatetime::now());
20 14
        $interval = new DateInterval('P1D');
21 14
        $tomorrow = $dateTime->add($interval);
22 14
        $dbDateTime = DBDatetime::create();
23 14
        $dbDateTime->setValue($tomorrow->format('Y-m-d 00:00:00'));
24
25 14
        return $dbDateTime;
26
    }
27
}
28