News::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 0
cts 11
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 8
crap 2

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 Gueststream\PMS\IQWare\API;
4
5
class News
6
{
7
8
    /**
9
     * @var int $ID_Article
10
     */
11
    protected $ID_Article = null;
12
13
    /**
14
     * @var \DateTime $CreationDate
15
     */
16
    protected $CreationDate = null;
17
18
    /**
19
     * @var \DateTime $FromDate
20
     */
21
    protected $FromDate = null;
22
23
    /**
24
     * @var \DateTime $ToDate
25
     */
26
    protected $ToDate = null;
27
28
    /**
29
     * @var string $ArticleName
30
     */
31
    protected $ArticleName = null;
32
33
    /**
34
     * @var string $Title
35
     */
36
    protected $Title = null;
37
38
    /**
39
     * @var string $Content
40
     */
41
    protected $Content = null;
42
43
    /**
44
     * @var int $ViewOrder
45
     */
46
    protected $ViewOrder = null;
47
48
    /**
49
     * @param int $ID_Article
50
     * @param \DateTime $CreationDate
51
     * @param \DateTime $FromDate
52
     * @param \DateTime $ToDate
53
     * @param string $ArticleName
54
     * @param string $Title
55
     * @param string $Content
56
     * @param int $ViewOrder
57
     */
58
    public function __construct($ID_Article, \DateTime $CreationDate, \DateTime $FromDate, \DateTime $ToDate, $ArticleName, $Title, $Content, $ViewOrder)
59
    {
60
        $this->ID_Article = $ID_Article;
61
        $this->CreationDate = $CreationDate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $CreationDate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $CreationDate.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
62
        $this->FromDate = $FromDate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $FromDate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $FromDate.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
63
        $this->ToDate = $ToDate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $ToDate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $ToDate.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
64
        $this->ArticleName = $ArticleName;
65
        $this->Title = $Title;
66
        $this->Content = $Content;
67
        $this->ViewOrder = $ViewOrder;
68
    }
69
70
    /**
71
     * @return int
72
     */
73
    public function getID_Article()
74
    {
75
        return $this->ID_Article;
76
    }
77
78
    /**
79
     * @param int $ID_Article
80
     * @return \Gueststream\PMS\IQWare\API\News
81
     */
82
    public function setID_Article($ID_Article)
83
    {
84
        $this->ID_Article = $ID_Article;
85
        return $this;
86
    }
87
88
    /**
89
     * @return \DateTime
90
     */
91
    public function getCreationDate()
92
    {
93
        if ($this->CreationDate == null) {
94
            return null;
95
        } else {
96
            try {
97
                return new \DateTime($this->CreationDate);
98
            } catch (\Exception $e) {
99
                return false;
100
            }
101
        }
102
    }
103
104
    /**
105
     * @param \DateTime $CreationDate
106
     * @return \Gueststream\PMS\IQWare\API\News
107
     */
108
    public function setCreationDate(\DateTime $CreationDate)
109
    {
110
        $this->CreationDate = $CreationDate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $CreationDate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $CreationDate.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
111
        return $this;
112
    }
113
114
    /**
115
     * @return \DateTime
116
     */
117
    public function getFromDate()
118
    {
119
        if ($this->FromDate == null) {
120
            return null;
121
        } else {
122
            try {
123
                return new \DateTime($this->FromDate);
124
            } catch (\Exception $e) {
125
                return false;
126
            }
127
        }
128
    }
129
130
    /**
131
     * @param \DateTime $FromDate
132
     * @return \Gueststream\PMS\IQWare\API\News
133
     */
134
    public function setFromDate(\DateTime $FromDate)
135
    {
136
        $this->FromDate = $FromDate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $FromDate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $FromDate.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
137
        return $this;
138
    }
139
140
    /**
141
     * @return \DateTime
142
     */
143
    public function getToDate()
144
    {
145
        if ($this->ToDate == null) {
146
            return null;
147
        } else {
148
            try {
149
                return new \DateTime($this->ToDate);
150
            } catch (\Exception $e) {
151
                return false;
152
            }
153
        }
154
    }
155
156
    /**
157
     * @param \DateTime $ToDate
158
     * @return \Gueststream\PMS\IQWare\API\News
159
     */
160
    public function setToDate(\DateTime $ToDate)
161
    {
162
        $this->ToDate = $ToDate->format(\DateTime::ATOM);
0 ignored issues
show
Documentation Bug introduced by
It seems like $ToDate->format(\DateTime::ATOM) of type string is incompatible with the declared type object<DateTime> of property $ToDate.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
163
        return $this;
164
    }
165
166
    /**
167
     * @return string
168
     */
169
    public function getArticleName()
170
    {
171
        return $this->ArticleName;
172
    }
173
174
    /**
175
     * @param string $ArticleName
176
     * @return \Gueststream\PMS\IQWare\API\News
177
     */
178
    public function setArticleName($ArticleName)
179
    {
180
        $this->ArticleName = $ArticleName;
181
        return $this;
182
    }
183
184
    /**
185
     * @return string
186
     */
187
    public function getTitle()
188
    {
189
        return $this->Title;
190
    }
191
192
    /**
193
     * @param string $Title
194
     * @return \Gueststream\PMS\IQWare\API\News
195
     */
196
    public function setTitle($Title)
197
    {
198
        $this->Title = $Title;
199
        return $this;
200
    }
201
202
    /**
203
     * @return string
204
     */
205
    public function getContent()
206
    {
207
        return $this->Content;
208
    }
209
210
    /**
211
     * @param string $Content
212
     * @return \Gueststream\PMS\IQWare\API\News
213
     */
214
    public function setContent($Content)
215
    {
216
        $this->Content = $Content;
217
        return $this;
218
    }
219
220
    /**
221
     * @return int
222
     */
223
    public function getViewOrder()
224
    {
225
        return $this->ViewOrder;
226
    }
227
228
    /**
229
     * @param int $ViewOrder
230
     * @return \Gueststream\PMS\IQWare\API\News
231
     */
232
    public function setViewOrder($ViewOrder)
233
    {
234
        $this->ViewOrder = $ViewOrder;
235
        return $this;
236
    }
237
}
238