NullObject::supportsToNative()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 1
Metric Value
cc 1
eloc 1
c 1
b 1
f 1
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
4
namespace Apie\TypeJuggling;
5
6
use Apie\ValueObjects\ValueObjectInterface;
0 ignored issues
show
Bug introduced by
The type Apie\ValueObjects\ValueObjectInterface 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...
7
8
class NullObject implements TypeUtilInterface
9
{
10
    public function fromNative($input)
11
    {
12
        return null;
13
    }
14
15
    public function toNative($input)
16
    {
17
        return null;
18
    }
19
20
    public function fromMissingValue()
21
    {
22
        return null;
23
    }
24
25
    public function supports($input): bool
26
    {
27
        if ($input instanceof ValueObjectInterface && $input->toNative() === null) {
28
            return true;
29
        }
30
        return $input === null;
31
    }
32
33
    public function supportsToNative($input): bool
34
    {
35
        return $input === null;
36
    }
37
38
    public function supportsFromNative($input): bool
39
    {
40
        return $input === null;
41
    }
42
43
    public function __toString()
44
    {
45
        return 'null';
46
    }
47
}
48