Passed
Push — main ( 278ef2...9ae846 )
by Torben
03:13
created

ModifyUserMessageSenderEvent::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

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

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 should be used to modify the sender data of a user message. Use the $type variable to distinguish
19
 * between the different types of messages
20
 */
21
final class ModifyUserMessageSenderEvent
22
{
23
    public function __construct(
24
        private string $senderName,
25
        private string $senderEmail,
26
        private string $replyToEmail,
27
        private string $subject,
28
        private string $body,
29
        private readonly Registration $registration,
30
        private readonly int $type,
31
        private readonly NotificationService $notificationService
32
    ) {
33
    }
34
35
    public function getSenderName(): string
36
    {
37
        return $this->senderName;
38
    }
39
40
    public function getSenderEmail(): string
41
    {
42
        return $this->senderEmail;
43
    }
44
45
    public function getReplyToEmail(): string
46
    {
47
        return $this->replyToEmail;
48
    }
49
50
    public function getRegistration(): Registration
51
    {
52
        return $this->registration;
53
    }
54
55
    public function getType(): int
56
    {
57
        return $this->type;
58
    }
59
60
    public function getSubject(): string
61
    {
62
        return $this->subject;
63
    }
64
65
    public function setSubject(string $subject): void
66
    {
67
        $this->subject = $subject;
68
    }
69
70
    public function getBody(): string
71
    {
72
        return $this->body;
73
    }
74
75
    public function setBody(string $body): void
76
    {
77
        $this->body = $body;
78
    }
79
80
    public function getNotificationService(): NotificationService
81
    {
82
        return $this->notificationService;
83
    }
84
85
    public function setSenderName(string $senderName): void
86
    {
87
        $this->senderName = $senderName;
88
    }
89
90
    public function setSenderEmail(string $senderEmail): void
91
    {
92
        $this->senderEmail = $senderEmail;
93
    }
94
95
    public function setReplyToEmail(string $replyToEmail): void
96
    {
97
        $this->replyToEmail = $replyToEmail;
98
    }
99
}
100