Completed
Pull Request — master (#2118)
by Maciej
19:12
created

DateImmutableType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 9
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getDateTime() 0 6 2
1
<?php
2
3
namespace Doctrine\ODM\MongoDB\Types;
4
5
use DateTime;
6
use DateTimeImmutable;
7
use DateTimeInterface;
8
9
class DateImmutableType extends DateType
10
{
11 19
    public static function getDateTime($value): DateTimeInterface
12
    {
13 19
        $datetime = parent::getDateTime($value);
14
15 14
        return $datetime instanceof DateTime ? DateTimeImmutable::createFromMutable($datetime) : $datetime;
16
    }
17
}
18