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

ChronosType::convertToPHPValue()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 9
cc 3
rs 10
ccs 0
cts 7
cp 0
crap 12
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