RssFeedConfiguration::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 34
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 16
c 1
b 0
f 0
dl 0
loc 34
rs 9.7333
cc 1
nc 1
nop 16

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
namespace PODEntender\Domain\Model\FileProcessing;
4
5
use DateTimeInterface;
6
7
class RssFeedConfiguration
8
{
9
    /** @var string */
10
    private $title;
11
12
    /** @var string */
13
    private $subtitle;
14
15
    /** @var string */
16
    private $description;
17
18
    /** @var DateTimeInterface */
19
    private $lastBuildDate;
20
21
    /** @var string */
22
    private $language;
23
24
    /** @var string */
25
    private $generator;
26
27
    /** @var string */
28
    private $managingEditor;
29
30
    /** @var string */
31
    private $imageUrl;
32
33
    /** @var string */
34
    private $url;
35
36
    /** @var string */
37
    private $feedUrl;
38
39
    /** @var string */
40
    private $author;
41
42
    /** @var string */
43
    private $explicit;
44
45
    /** @var string */
46
    private $type;
47
48
    /** @var string */
49
    private $email;
50
51
    /** @var string */
52
    private $category;
53
54
    /** @var string */
55
    private $outputFilepath;
56
57
    public function __construct(
58
        string $title,
59
        string $subtitle,
60
        string $description,
61
        DateTimeInterface $lastBuildDate,
62
        string $language,
63
        string $generator,
64
        string $managingEditor,
65
        string $imageUrl,
66
        string $url,
67
        string $feedUrl,
68
        string $author,
69
        string $explicit,
70
        string $type,
71
        string $email,
72
        string $category,
73
        string $outputFilepath
74
    ) {
75
        $this->title = $title;
76
        $this->subtitle = $subtitle;
77
        $this->description = $description;
78
        $this->lastBuildDate = $lastBuildDate;
79
        $this->language = $language;
80
        $this->generator = $generator;
81
        $this->managingEditor = $managingEditor;
82
        $this->imageUrl = $imageUrl;
83
        $this->url = $url;
84
        $this->feedUrl = $feedUrl;
85
        $this->author = $author;
86
        $this->explicit = $explicit;
87
        $this->type = $type;
88
        $this->email = $email;
89
        $this->category = $category;
90
        $this->outputFilepath = $outputFilepath;
91
    }
92
93
    public function title(): string
94
    {
95
        return $this->title;
96
    }
97
98
    public function subtitle(): string
99
    {
100
        return $this->subtitle;
101
    }
102
103
    public function description(): string
104
    {
105
        return $this->description;
106
    }
107
108
    public function lastBuildDate(): DateTimeInterface
109
    {
110
        return $this->lastBuildDate;
111
    }
112
113
    public function language(): string
114
    {
115
        return $this->language;
116
    }
117
118
    public function generator(): string
119
    {
120
        return $this->generator;
121
    }
122
123
    public function managingEditor(): string
124
    {
125
        return $this->managingEditor;
126
    }
127
128
    public function imageUrl(): string
129
    {
130
        return $this->imageUrl;
131
    }
132
133
    public function url(): string
134
    {
135
        return $this->url;
136
    }
137
138
    public function feedUrl(): string
139
    {
140
        return $this->feedUrl;
141
    }
142
143
    public function author(): string
144
    {
145
        return $this->author;
146
    }
147
148
    public function explicit(): string
149
    {
150
        return $this->explicit;
151
    }
152
153
    public function type(): string
154
    {
155
        return $this->type;
156
    }
157
158
    public function email(): string
159
    {
160
        return $this->email;
161
    }
162
163
    public function category(): string
164
    {
165
        return $this->category;
166
    }
167
168
    public function outputFilepath(): string
169
    {
170
        return $this->outputFilepath;
171
    }
172
}
173