Completed
Pull Request — master (#246)
by Beñat
03:48
created

EditProfileCommand::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 17
nc 1
nop 8
dl 0
loc 19
rs 9.4285
c 0
b 0
f 0

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
/*
4
 * This file is part of the Kreta package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
declare(strict_types = 1);
14
15
namespace Kreta\IdentityAccess\Application\Command;
16
17
class EditProfileCommand
18
{
19
    private $id;
20
    private $email;
21
    private $username;
22
    private $firstName;
23
    private $lastName;
24
    private $imageName;
25
    private $imageMimeType;
26
    private $uploadedImage;
27
28
    public function __construct(
29
        string $id,
30
        string $email,
31
        string $username,
32
        string $firsName,
33
        string $lastName,
34
        $imageName,
35
        $imageMimeType,
36
        $uploadedImage
37
    ) {
38
        $this->id = $id;
39
        $this->email = $email;
40
        $this->username = $username;
41
        $this->firstName = $firsName;
42
        $this->lastName = $lastName;
43
        $this->imageName = $imageName;
44
        $this->imageMimeType = $imageMimeType;
45
        $this->uploadedImage = $uploadedImage;
46
    }
47
48
    public function id() : string
49
    {
50
        return $this->id;
51
    }
52
53
    public function email() : string
54
    {
55
        return $this->email;
56
    }
57
58
    public function username() : string
59
    {
60
        return $this->username;
61
    }
62
63
    public function firstName() : string
64
    {
65
        return $this->firstName;
66
    }
67
68
    public function lastName() : string
69
    {
70
        return $this->lastName;
71
    }
72
73
    public function imageName()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
74
    {
75
        return $this->imageName;
76
    }
77
78
    public function imageMimeType()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
79
    {
80
        return $this->imageMimeType;
81
    }
82
83
    public function uploadedImage()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
84
    {
85
        return $this->uploadedImage;
86
    }
87
}
88