Completed
Push — master ( 70dfe1...a97a1c )
by Torben
04:18
created

AfterUserMessageSentEvent::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

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

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 Extension "sf_event_mgt" for TYPO3 CMS.
7
 *
8
 * For the full copyright and license information, please read the
9
 * LICENSE.txt file that was distributed with this source code.
10
 */
11
12
namespace DERHANSEN\SfEventMgt\Event;
13
14
use DERHANSEN\SfEventMgt\Domain\Model\Registration;
15
use DERHANSEN\SfEventMgt\Service\NotificationService;
16
17
/**
18
 * This event is triggered after a user message has been sent
19
 */
20
final class AfterUserMessageSentEvent
21
{
22
    /**
23
     * @var Registration
24
     */
25
    private $registration;
26
27
    /**
28
     * @var string
29
     */
30
    private $body;
31
32
    /**
33
     * @var string
34
     */
35
    private $subject;
36
37
    /**
38
     * @var array
39
     */
40
    private $attachments;
41
42
    /**
43
     * @var string
44
     */
45
    private $senderName;
46
47
    /**
48
     * @var string
49
     */
50
    private $senderEmail;
51
52
    /**
53
     * @var string
54
     */
55
    private $replyToEmail;
56
57
    /**
58
     * @var NotificationService
59
     */
60
    private $notificationService;
61
62
    public function __construct(
63
        Registration $registration,
64
        string $body,
65
        string $subject,
66
        array $attachments,
67
        string $senderName,
68
        string $senderEmail,
69
        string $replyToEmail,
70
        NotificationService $notificationService
71
    ) {
72
        $this->registration = $registration;
73
        $this->body = $body;
74
        $this->subject = $subject;
75
        $this->attachments = $attachments;
76
        $this->senderName = $senderName;
77
        $this->senderEmail = $senderEmail;
78
        $this->replyToEmail = $replyToEmail;
79
        $this->notificationService = $notificationService;
80
    }
81
82
    /**
83
     * @return Registration
84
     */
85
    public function getRegistration(): Registration
86
    {
87
        return $this->registration;
88
    }
89
90
    /**
91
     * @return string
92
     */
93
    public function getBody(): string
94
    {
95
        return $this->body;
96
    }
97
98
    /**
99
     * @return string
100
     */
101
    public function getSubject(): string
102
    {
103
        return $this->subject;
104
    }
105
106
    /**
107
     * @return array
108
     */
109
    public function getAttachments(): array
110
    {
111
        return $this->attachments;
112
    }
113
114
    /**
115
     * @return string
116
     */
117
    public function getSenderName(): string
118
    {
119
        return $this->senderName;
120
    }
121
122
    /**
123
     * @return string
124
     */
125
    public function getSenderEmail(): string
126
    {
127
        return $this->senderEmail;
128
    }
129
130
    /**
131
     * @return string
132
     */
133
    public function getReplyToEmail(): string
134
    {
135
        return $this->replyToEmail;
136
    }
137
138
    /**
139
     * @return NotificationService
140
     */
141
    public function getNotificationService(): NotificationService
142
    {
143
        return $this->notificationService;
144
    }
145
}
146