Failed Conditions
Push — master ( e75200...fab761 )
by Adrien
02:43
created

TimeType::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
dl 0
loc 9
ccs 0
cts 5
cp 0
rs 10
cc 3
nc 2
nop 2
crap 12
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ecodev\Felix\DBAL\Types;
6
7
use Cake\Chronos\ChronosTime;
1 ignored issue
show
Bug introduced by
The type Cake\Chronos\ChronosTime was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use DateTimeInterface;
9
use Doctrine\DBAL\Platforms\AbstractPlatform;
10
11
final class TimeType extends \Doctrine\DBAL\Types\TimeType
12
{
13
    /**
14
     * @param null|ChronosTime|DateTimeInterface|string $value
15
     */
16
    public function convertToPHPValue(mixed $value, AbstractPlatform $platform): ?ChronosTime
17
    {
18
        if ($value === null || $value instanceof ChronosTime) {
19
            return $value;
20
        }
21
22
        $val = new ChronosTime($value);
23
24
        return $val;
25
    }
26
}
27