Passed
Push — master ( c541cb...64a56e )
by Chris
33s
created

Delegate::fromArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 1
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
ccs 8
cts 8
cp 1
crap 1
1
<?php
2
3
namespace ConferenceTools\Tickets\Domain\ValueObject;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use JMS\Serializer\Annotation as JMS;
7
8
/**
9
 * Class Delegate
10
 * @package ConferenceTools\Tickets\Domain\ValueObject
11
 * @ORM\Embeddable()
12
 */
13
class Delegate
14
{
15
    /**
16
     * @var string
17
     * @ORM\Column(type="string")
18
     * @JMS\Type("string")
19
     */
20
    private $firstname;
21
    /**
22
     * @var string
23
     * @ORM\Column(type="string")
24
     * @JMS\Type("string")
25
     */
26
    private $lastname;
27
    /**
28
     * @var string
29
     * @ORM\Column(type="string")
30
     * @JMS\Type("string")
31
     */
32
    private $email;
33
    /**
34
     * @var string
35
     * @ORM\Column(type="string")
36
     * @JMS\Type("string")
37
     */
38
    private $company;
39
    /**
40
     * @var string
41
     * @ORM\Column(type="string")
42
     * @JMS\Type("string")
43
     */
44
    private $twitter;
45
    /**
46
     * @var string
47
     * @ORM\Column(type="string")
48
     * @JMS\Type("string")
49
     */
50
    private $requirements;
51
52
    /**
53
     * Delegate constructor.
54
     * @param string $firstname
55
     * @param string $lastname
56
     * @param string $email
57
     * @param string $company
58
     * @param string $twitter
59
     * @param string $requirements
60
     */
61 7
    public function __construct(string $firstname, string $lastname, string $email, string $company, string $twitter, string $requirements)
62
    {
63 7
        $this->firstname = $firstname;
64 7
        $this->lastname = $lastname;
65 7
        $this->email = $email;
66 7
        $this->company = $company;
67 7
        $this->twitter = $twitter;
68 7
        $this->requirements = $requirements;
69 7
    }
70
71 6
    public static function emptyObject()
72
    {
73 6
        return new static('', '', '', '', '', '', '');
0 ignored issues
show
Unused Code introduced by
The call to Delegate::__construct() has too many arguments starting with ''.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
74
    }
75
76 2
    public static function fromArray(array $data)
77
    {
78 2
        return new static(
79 2
            $data['firstname'],
80 2
            $data['lastname'],
81 2
            $data['email'],
82 2
            $data['company'],
83 2
            $data['twitter'],
84 2
            $data['requirements']
85
        );
86
    }
87
88
    /**
89
     * @return string
90
     */
91 2
    public function getFirstname()
92
    {
93 2
        return $this->firstname;
94
    }
95
96
    /**
97
     * @return string
98
     */
99 2
    public function getLastname()
100
    {
101 2
        return $this->lastname;
102
    }
103
104
    /**
105
     * @return string
106
     */
107 2
    public function getEmail()
108
    {
109 2
        return $this->email;
110
    }
111
112
    /**
113
     * @return string
114
     */
115 2
    public function getCompany()
116
    {
117 2
        return $this->company;
118
    }
119
120
    /**
121
     * @return string
122
     */
123 2
    public function getTwitter()
124
    {
125 2
        return $this->twitter;
126
    }
127
128
    /**
129
     * @return string
130
     */
131 2
    public function getRequirements()
132
    {
133 2
        return $this->requirements;
134
    }
135
}
136