Passed
Pull Request — develop (#118)
by Laurent
05:08 queued 02:44
created

ContactAddress::fromString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 4
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the  G.L.S.R. Apps package.
7
 *
8
 * (c) Dev-Int Création <[email protected]>.
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Domain\Common\Model\VO;
15
16
final class ContactAddress
17
{
18
    private string $address;
19
    private string $zipCode;
20
    private string $town;
21
    private string $country;
22
23
    public function __construct(string $address, string $zipCode, string $town, string $country)
24
    {
25
        $this->address = $address;
26
        $this->zipCode = $zipCode;
27
        $this->town = $town;
28
        $this->country = $country;
29
    }
30
31
    public static function fromString(string $address, string $zipCode, string $town, string $country): self
32
    {
33
        return new self($address, $zipCode, $town, $country);
34
    }
35
36
    public function getValue(): string
37
    {
38
        return $this->address . "\n" . $this->zipCode . ' ' . $this->town . ', ' . $this->country;
39
    }
40
}
41