NullValue   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 40
ccs 8
cts 8
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A fromNative() 0 4 1
A create() 0 4 1
A sameValueAs() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
namespace ValueObjects\NullValue;
4
5
use ValueObjects\Util\Util;
6
use ValueObjects\ValueObjectInterface;
7
8
class NullValue implements ValueObjectInterface
9
{
10
    /**
11
     * @throws \BadMethodCallException
12
     */
13 1
    public static function fromNative()
14
    {
15 1
        throw new \BadMethodCallException('Cannot create a NullValue object via this method.');
16
    }
17
18
    /**
19
     * Returns a new NullValue object
20
     *
21
     * @return static
22
     */
23 5
    public static function create()
24
    {
25 5
        return new static();
26
    }
27
28
    /**
29
     * Tells whether two objects are both NullValue
30
     * @param  ValueObjectInterface $null
31
     * @return bool
32
     */
33 5
    public function sameValueAs(ValueObjectInterface $null)
34
    {
35 5
        return Util::classEquals($this, $null);
36
    }
37
38
    /**
39
     * Returns a string representation of the NullValue object
40
     *
41
     * @return string
42
     */
43 1
    public function __toString()
44
    {
45 1
        return \strval(null);
46
    }
47
}
48