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

TimeType   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
wmc 3
eloc 5
c 1
b 0
f 0
dl 0
loc 14
ccs 0
cts 5
cp 0
rs 10

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\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