Passed
Push — develop ( 229fa6...7d2e81 )
by Laurent
08:00 queued 04:20
created

Supplier::uuid()   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 0
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\Supplier\Model;
15
16
use Domain\Common\Model\Contact;
17
use Domain\Common\Model\Entities\FamilyLog;
18
use Domain\Common\Model\VO\EmailField;
19
use Domain\Common\Model\VO\NameField;
20
use Domain\Common\Model\VO\PhoneField;
21
22
final class Supplier extends Contact
23
{
24
    protected string $uuid;
25
    private FamilyLog $familyLog;
26
    private int $delayDelivery;
27
    private array $orderDays;
28
    private bool $active;
29
30
    public function __construct(
31
        SupplierUuid $uuid,
32
        NameField $name,
33
        string $address,
34
        string $zipCode,
35
        string $town,
36
        string $country,
37
        PhoneField $phone,
38
        PhoneField $facsimile,
39
        EmailField $email,
40
        string $contact,
41
        PhoneField $cellphone,
42
        FamilyLog $familyLog,
43
        int $delayDelivery,
44
        array $orderDays,
45
        bool $active = true
46
    ) {
47
        parent::__construct(
48
            $uuid,
49
            $name,
50
            $address,
51
            $zipCode,
52
            $town,
53
            $country,
54
            $phone,
55
            $facsimile,
56
            $email,
57
            $contact,
58
            $cellphone
59
        );
60
        $this->familyLog = $familyLog;
61
        $this->delayDelivery = $delayDelivery;
62
        $this->orderDays = $orderDays;
63
        $this->active = $active;
64
    }
65
66
    public static function create(
67
        SupplierUuid $uuid,
68
        NameField $name,
69
        string $address,
70
        string $zipCode,
71
        string $town,
72
        string $country,
73
        PhoneField $phone,
74
        PhoneField $facsimile,
75
        EmailField $email,
76
        string $contact,
77
        PhoneField $gsm,
78
        FamilyLog $familyLog,
79
        int $delayDelivery,
80
        array $orderDays,
81
        bool $active = true
82
    ): self {
83
        return new self(
84
            $uuid,
85
            $name,
86
            $address,
87
            $zipCode,
88
            $town,
89
            $country,
90
            $phone,
91
            $facsimile,
92
            $email,
93
            $contact,
94
            $gsm,
95
            $familyLog,
96
            $delayDelivery,
97
            $orderDays,
98
            $active
99
        );
100
    }
101
102
    public function renameSupplier(NameField $name): void
103
    {
104
        $this->name = $name->getValue();
105
        $this->slug = $name->slugify();
106
    }
107
108
    public function familyLog(): FamilyLog
109
    {
110
        return $this->familyLog;
111
    }
112
113
    public function setFamilyLog(FamilyLog $familyLog): void
114
    {
115
        $this->familyLog = $familyLog;
116
    }
117
118
    public function delayDelivery(): int
119
    {
120
        return $this->delayDelivery;
121
    }
122
123
    public function setDelayDelivery(int $delayDelivery): void
124
    {
125
        $this->delayDelivery = $delayDelivery;
126
    }
127
128
    public function getOrderDays(): array
129
    {
130
        return $this->orderDays;
131
    }
132
133
    public function setOrderDays(array $orderDays): void
134
    {
135
        $this->orderDays = $orderDays;
136
    }
137
138
    public function isActive(): bool
139
    {
140
        return $this->active;
141
    }
142
143
    public function setActive(bool $active): void
144
    {
145
        $this->active = $active;
146
    }
147
148
    public function getSlug(): string
149
    {
150
        return $this->slug;
151
    }
152
153
    public function setSlug(string $slug): void
154
    {
155
        $this->slug = $slug;
156
    }
157
}
158