NullObject   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isEmpty() 0 3 1
A isNull() 0 3 1
A isEqualTo() 0 9 3
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
}