Completed
Push — main ( fffb13...d8afdd )
by Laurent
139:07 queued 124:29
created

ContactAddress   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 47
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A fromString() 0 4 1
A getValue() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Domain\Model\Common\VO;
6
7
final class ContactAddress
8
{
9
    /**
10
     * @var string Address
11
     */
12
    protected $address;
13
    /**
14
     * @var string Zip code
15
     */
16
    protected $zipCode;
17
18
    /**
19
     * @var string Town
20
     */
21
    protected $town;
22
23
    /**
24
     * @var string Country
25
     */
26
    protected $country;
27
28
    /**
29
     * ContactAddress constructor.
30
     *
31
     * @param string $address
32
     * @param string $zipCode
33
     * @param string $town
34
     * @param string $country
35
     */
36
    public function __construct(string $address, string $zipCode, string $town, string $country)
37
    {
38
        $this->address = $address;
39
        $this->zipCode = $zipCode;
40
        $this->town = $town;
41
        $this->country = $country;
42
    }
43
44
    public static function fromString(string $address, string $zipCode, string $town, string $country): self
45
    {
46
        return new self($address, $zipCode, $town, $country);
47
    }
48
49
    public function getValue(): string
50
    {
51
        return $this->address."\n".$this->zipCode.' '.$this->town.', '.$this->country;
52
    }
53
}
54