Failed Conditions
Push — master ( 5e6761...398dce )
by Adrien
04:14 queued 01:57
created

ChronosType   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 14
rs 10
ccs 0
cts 7
cp 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A convertToPHPValue() 0 9 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ecodev\Felix\DBAL\Types;
6
7
use Cake\Chronos\Chronos;
8
use Doctrine\DBAL\Platforms\AbstractPlatform;
9
10
class ChronosType extends \Doctrine\DBAL\Types\DateTimeType
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function convertToPHPValue($value, AbstractPlatform $platform)
16
    {
17
        if ($value === null || $value instanceof Chronos) {
18
            return $value;
19
        }
20
21
        $val = new Chronos($value);
22
23
        return $val;
24
    }
25
}
26