Passed
Push — master ( 2ee0d1...1e8995 )
by Tomasz
03:21
created

AbstractStringValueObject   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A equal() 0 4 2
A getValue() 0 3 1
A __construct() 0 4 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Aggrego\Domain\Shared\ValueObject;
6
7
abstract class AbstractStringValueObject
8
{
9
    /** @var string */
10
    private $value;
11
12
    /** @var string */
13
    private $type;
14
15
    public function __construct(string $value, string $type)
16
    {
17
        $this->value = $value;
18
        $this->type = $type;
19
    }
20
21
    public function getValue(): string
22
    {
23
        return $this->value;
24
    }
25
26
    public function equal(self $object): bool
27
    {
28
        return $this->value === $object->value
29
            && $this->type === $object->type;
30
    }
31
}
32