Conditions | 1 |
Paths | 1 |
Total Lines | 15 |
Code Lines | 0 |
Lines | 0 |
Ratio | 0 % |
Tests | 1 |
CRAP Score | 1 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
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 |
||
9 | 6 | public function __construct( |
|
10 | public int $contactId, |
||
11 | public string $firstName, |
||
12 | public string $prefix, |
||
13 | public string $lastName, |
||
14 | public string $email, |
||
15 | public string $phone, |
||
16 | public ?string $organisation, |
||
17 | public int $parentSituationId, |
||
18 | public string $function, |
||
19 | public string $publicPhone, |
||
20 | public bool $active, |
||
21 | public int $createdById, |
||
22 | public int $changedById |
||
23 | ) { |
||
24 | 6 | } |
|
26 |