Failed Conditions
Push — master ( 356b1f...e74f9e )
by Adrien
10:44
created

DateType::convertToPHPValue()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 4
nc 2
nop 2
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\DBAL\Types;
6
7
use Cake\Chronos\Date;
8
use Doctrine\DBAL\Platforms\AbstractPlatform;
9
10
class DateType extends \Doctrine\DBAL\Types\DateType
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function convertToPHPValue($value, AbstractPlatform $platform)
16
    {
17
        if ($value === null || $value instanceof Date) {
18
            return $value;
19
        }
20
21
        $val = new Date($value);
22
23
        return $val;
24
    }
25
}
26