Passed
Push — master ( a714a7...2bb7f4 )
by Thorsten
02:02
created

NestedEntity::equals()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 3
cts 4
cp 0.75
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
crap 2.0625
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 $entity): bool
10
    {
11 2
        if (!$entity instanceof static) {
12
            return false;
13
        }
14 2
        return (new EntityDiff)($this, $entity)->isEmpty();
15
    }
16
17 2
    public function __toString(): string
18
    {
19 2
        return sprintf('%s:%s', $this->getEntityType()->getName(), $this->getIdentity());
20
    }
21
}
22