DateService   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 18
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getTomorrow() 0 10 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