Passed
Push — master ( 819f30...8ceff2 )
by Thorsten
02:22
created

NestedEntity::isEmpty()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 5
cts 5
cp 1
rs 9.6666
c 0
b 0
f 0
cc 3
eloc 5
nc 3
nop 0
crap 3
1
<?php
2
3
namespace Daikon\Entity\Entity;
4
5
use Daikon\Entity\ValueObject\ValueObjectInterface;
6
7
abstract class NestedEntity extends Entity implements ValueObjectInterface
8
{
9 2
    public function equals(ValueObjectInterface $otherValue): bool
10
    {
11 2
        if (!$otherValue instanceof self) {
12
            return false;
13
        }
14 2
        foreach ($this->getValueObjectMap() as $attrName => $value) {
15 2
            if (!$value->equals($otherValue->get($attrName))) {
16 2
                return false;
17
            }
18
        }
19 2
        return true;
20
    }
21
22 2
    public function __toString(): string
23
    {
24 2
        return sprintf("%s:%s", $this->getEntityType()->getName(), $this->getIdentity());
25
    }
26
}
27