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

NestedEntity   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 15
ccs 5
cts 6
cp 0.8333
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A equals() 0 7 2
A __toString() 0 4 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