NullValue::sameValueAs()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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