Contact::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 27
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 13
c 1
b 0
f 0
nc 1
nop 12
dl 0
loc 27
rs 9.8333

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

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 Administration\Infrastructure\Persistence\DoctrineOrm\Entities;
15
16
use Core\Infrastructure\Doctrine\Entity\ResourceUuid as ResourceUuidTrait;
17
use Doctrine\ORM\Mapping as ORM;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\Mapping was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
19
/**
20
 * @ORM\MappedSuperclass
21
 */
22
class Contact
23
{
24
    use ResourceUuidTrait;
25
26
    /**
27
     * @ORM\Column(type="string", name="company_name", unique=true, nullable=false)
28
     */
29
    protected string $companyName;
30
31
    /**
32
     * @ORM\Column(type="string", name="address", nullable=false)
33
     */
34
    protected string $address;
35
36
    /**
37
     * @ORM\Column(type="string", length=5, name="zip_code", nullable=false)
38
     */
39
    protected string $zipCode;
40
41
    /**
42
     * @ORM\Column(type="string", name="town", nullable=false)
43
     */
44
    protected string $town;
45
46
    /**
47
     * @ORM\Column(type="string", name="country", nullable=false)
48
     */
49
    protected string $country;
50
51
    /**
52
     * @ORM\Column(type="string", length=14, name="phone", nullable=false)
53
     */
54
    protected string $phone;
55
56
    /**
57
     * @ORM\Column(type="string", length=14, name="facsimile", nullable=true)
58
     */
59
    protected string $facsimile;
60
61
    /**
62
     * @ORM\Column(type="string", name="email", nullable=false)
63
     */
64
    protected string $email;
65
66
    /**
67
     * @ORM\Column(type="string", name="contact_name", nullable=false)
68
     */
69
    protected string $contactName;
70
71
    /**
72
     * @ORM\Column(type="string", length=14, name="cellphone", nullable=false)
73
     */
74
    protected string $cellphone;
75
76
    /**
77
     * @ORM\Column(type="string", name="slug", unique=true, nullable=false)
78
     */
79
    protected string $slug;
80
81
    public function __construct(
82
        string $uuid,
83
        string $companyName,
84
        string $address,
85
        string $zipCode,
86
        string $town,
87
        string $country,
88
        string $phone,
89
        string $facsimile,
90
        string $email,
91
        string $contactName,
92
        string $cellphone,
93
        string $slug
94
    ) {
95
        $this->uuid = $uuid;
96
        $this->companyName = $companyName;
97
        $this->address = $address;
98
        $this->zipCode = $zipCode;
99
        $this->town = $town;
100
        $this->country = $country;
101
        $this->phone = $phone;
102
        $this->facsimile = $facsimile;
103
        $this->email = $email;
104
        $this->contactName = $contactName;
105
        $this->cellphone = $cellphone;
106
        $this->slug = $slug;
107
    }
108
109
    public static function create(
110
        string $uuid,
111
        string $companyName,
112
        string $address,
113
        string $zipCode,
114
        string $town,
115
        string $country,
116
        string $phone,
117
        string $facsimile,
118
        string $email,
119
        string $contactName,
120
        string $cellphone,
121
        string $slug
122
    ): self {
123
        return new self(
124
            $uuid,
125
            $companyName,
126
            $address,
127
            $zipCode,
128
            $town,
129
            $country,
130
            $phone,
131
            $facsimile,
132
            $email,
133
            $contactName,
134
            $cellphone,
135
            $slug
136
        );
137
    }
138
139
    public function getCompanyName(): string
140
    {
141
        return $this->companyName;
142
    }
143
144
    public function setCompanyName(string $companyName): self
145
    {
146
        $this->companyName = $companyName;
147
148
        return $this;
149
    }
150
151
    public function getAddress(): string
152
    {
153
        return $this->address;
154
    }
155
156
    public function setAddress(string $address): self
157
    {
158
        $this->address = $address;
159
160
        return $this;
161
    }
162
163
    public function getZipCode(): string
164
    {
165
        return $this->zipCode;
166
    }
167
168
    public function setZipCode(string $zipCode): self
169
    {
170
        $this->zipCode = $zipCode;
171
172
        return $this;
173
    }
174
175
    public function getTown(): string
176
    {
177
        return $this->town;
178
    }
179
180
    public function setTown(string $town): self
181
    {
182
        $this->town = $town;
183
184
        return $this;
185
    }
186
187
    public function getCountry(): string
188
    {
189
        return $this->country;
190
    }
191
192
    public function setCountry(string $country): self
193
    {
194
        $this->country = $country;
195
196
        return $this;
197
    }
198
199
    public function getPhone(): string
200
    {
201
        return $this->phone;
202
    }
203
204
    public function setPhone(string $phone): self
205
    {
206
        $this->phone = $phone;
207
208
        return $this;
209
    }
210
211
    public function getFacsimile(): string
212
    {
213
        return $this->facsimile;
214
    }
215
216
    public function setFacsimile(string $facsimile): self
217
    {
218
        $this->facsimile = $facsimile;
219
220
        return $this;
221
    }
222
223
    public function getEmail(): string
224
    {
225
        return $this->email;
226
    }
227
228
    public function setEmail(string $email): self
229
    {
230
        $this->email = $email;
231
232
        return $this;
233
    }
234
235
    public function getContactName(): string
236
    {
237
        return $this->contactName;
238
    }
239
240
    public function setContactName(string $contactName): self
241
    {
242
        $this->contactName = $contactName;
243
244
        return $this;
245
    }
246
247
    public function getCellphone(): string
248
    {
249
        return $this->cellphone;
250
    }
251
252
    public function setCellphone(string $cellphone): self
253
    {
254
        $this->cellphone = $cellphone;
255
256
        return $this;
257
    }
258
259
    public function getSlug(): string
260
    {
261
        return $this->slug;
262
    }
263
264
    public function setSlug(string $slug): self
265
    {
266
        $this->slug = $slug;
267
268
        return $this;
269
    }
270
}
271