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

NestedEntity::__toString()   A

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