Completed
Pull Request — master (#2118)
by Maciej
30:32 queued 05:27
created

DateImmutableType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 9
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
    public static function getDateTime($value) : DateTimeInterface
14
    {
15
        $datetime = parent::getDateTime($value);
16
17
        return $datetime instanceof DateTime ? DateTimeImmutable::createFromMutable($datetime) : $datetime;
18
    }
19
}
20