Completed
Push — master ( 01d8d1...58ca4d )
by Simon
01:47
created

DateService   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 18
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getTomorrow() 0 10 1
1
<?php
2
3
namespace Firesphere\PartialUserforms\Services;
4
5
6
use DateInterval;
7
use DateTime;
8
use SilverStripe\ORM\FieldType\DBDatetime;
9
10
class DateService
11
{
12
13
    /**
14
     * @return DBDatetime|static
15
     * @throws \Exception
16
     */
17
    public static function getTomorrow()
18
    {
19
        $dateTime = new DateTime(DBDatetime::now());
20
        $interval = new DateInterval('P1D');
21
        $tomorrow = $dateTime->add($interval);
22
        $dbDateTime = DBDatetime::create();
23
        $dbDateTime->setValue($tomorrow->format('Y-m-d 00:00:00'));
24
25
        return $dbDateTime;
26
    }
27
}