Completed
Pull Request — master (#2118)
by Maciej
19:54 queued 05:01
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
declare(strict_types=1);
4
5
namespace Doctrine\ODM\MongoDB\Types;
6
7
use DateTime;
8
use DateTimeImmutable;
9
use DateTimeInterface;
10
11
class DateImmutableType extends DateType
12
{
13 19
    public static function getDateTime($value) : DateTimeInterface
14
    {
15 19
        $datetime = parent::getDateTime($value);
16
17 14
        return $datetime instanceof DateTime ? DateTimeImmutable::createFromMutable($datetime) : $datetime;
18
    }
19
}
20