Passed
Pull Request — main (#1327)
by
unknown
13:28
created

ModifyAdminMessageSenderEvent::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 9
dl 0
loc 11
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
use Psr\Http\Message\ServerRequestInterface;
17
18
/**
19
 * This event should be used to modify the sender data of aa admin message. Use the $type variable to distinguish
20
 * between the different types of messages
21
 */
22
final class ModifyAdminMessageSenderEvent
23
{
24
    public function __construct(
25
        private string $senderName,
26
        private string $senderEmail,
27
        private string $replyToEmail,
28
        private string $subject,
29
        private string $body,
30
        private readonly Registration $registration,
31
        private readonly int $type,
32
        private readonly NotificationService $notificationService,
33
        private readonly ServerRequestInterface $request
34
    ) {
35
    }
36
37
    public function getSenderName(): string
38
    {
39
        return $this->senderName;
40
    }
41
42
    public function getSenderEmail(): string
43
    {
44
        return $this->senderEmail;
45
    }
46
47
    public function getReplyToEmail(): string
48
    {
49
        return $this->replyToEmail;
50
    }
51
52
    public function getRegistration(): Registration
53
    {
54
        return $this->registration;
55
    }
56
57
    public function getType(): int
58
    {
59
        return $this->type;
60
    }
61
62
    public function getSubject(): string
63
    {
64
        return $this->subject;
65
    }
66
67
    public function setSubject(string $subject): void
68
    {
69
        $this->subject = $subject;
70
    }
71
72
    public function getBody(): string
73
    {
74
        return $this->body;
75
    }
76
77
    public function setBody(string $body): void
78
    {
79
        $this->body = $body;
80
    }
81
82
    public function getNotificationService(): NotificationService
83
    {
84
        return $this->notificationService;
85
    }
86
87
    public function setSenderName(string $senderName): void
88
    {
89
        $this->senderName = $senderName;
90
    }
91
92
    public function setSenderEmail(string $senderEmail): void
93
    {
94
        $this->senderEmail = $senderEmail;
95
    }
96
97
    public function setReplyToEmail(string $replyToEmail): void
98
    {
99
        $this->replyToEmail = $replyToEmail;
100
    }
101
102
    public function getRequest(): ServerRequestInterface
103
    {
104
        return $this->request;
105
    }
106
}
107