NullObject::isEqualTo()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 7
nc 3
nop 1
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
namespace PHPKitchen\Platform\Data;
4
5
use PHPKitchen\Platform\Contract\Data\ValueObject;
6
7
/**
8
 * Represents basic null object.
9
 *
10
 * @author Dmitry Kolodko <[email protected]>
11
 * @since 1.0
12
 */
13
class NullObject implements ValueObject {
14
    public function isEmpty(): bool {
15
        return true;
16
    }
17
18
    public function isNull(): bool {
19
        return true;
20
    }
21
22
    public function isEqualTo($value): bool {
23
        if (null === $value) {
24
            return true;
25
        } elseif ($value instanceof NullObject) {
26
            return true;
27
        } else {
28
            return false;
29
        }
30
    }
31
}