Campaign   A
last analyzed

Complexity

Total Complexity 20

Size/Duplication

Total Lines 244
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 20
c 2
b 1
f 0
lcom 2
cbo 0
dl 0
loc 244
ccs 56
cts 56
cp 1
rs 10

19 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A setName() 0 6 1
A getName() 0 4 1
A getState() 0 4 1
A setFolderId() 0 6 1
A getFolderId() 0 4 1
A setStartDate() 0 6 1
A getStartDate() 0 4 1
A setDescription() 0 6 1
A getDescription() 0 4 1
A setMaCategory() 0 6 1
A getMaCategory() 0 4 1
A setProductId() 0 6 1
A getProductId() 0 4 1
A setClashPlanId() 0 6 1
A getClashPlanId() 0 4 1
A addEmail() 0 6 1
A getEmails() 0 4 1
A setState() 0 17 2
1
<?php
2
3
/**
4
 * This file is part of the Mediapart Selligent Client API
5
 *
6
 * CC BY-NC-SA <https://github.com/mediapart/selligent>
7
 *
8
 * For the full license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Mediapart\Selligent\Broadcast;
13
14
/**
15
 *
16
 */
17
class Campaign
18
{
19
    const TEST = 'TEST';
20
    const ACTIVE = 'ACTIVE';
21
    const HOLD = 'HOLD';
22
    const DESIGN = 'DESIGN';
23
24
    /**
25
     * @var string The name of the journey map.
26
     */
27
    private $name;
28
29
    /**
30
     * @var string Possible values are Test, Active, Hold, Design. By default the value is set to Design.
31
     */
32
    private $state;
33
34
    /**
35
     * @var integer The ID of the folder in which the journey map is created.
36
     */
37
    private $folderId;
38
39
    /**
40
     * @var \DateTimeInterface This is the start date for the journey map.
41
     */
42
    private $startDate;
43
44
    /**
45
     * @var string The description of the journey map as defined in the properties
46
     */
47
    private $description;
48
49
    /**
50
     * @var string The category defined for the journey map, if any.
51
     */
52
    private $maCategory;
53
54
    /**
55
     * @var integer The ID of the product defined for the journey map, if any.
56
     */
57
    private $productId;
58
59
    /**
60
     * @var integer The ID of the marketing pressure plan to which the journey map is linked.
61
     */
62
    private $clashPlanId;
63
64
    /**
65
     * @var Email[]
66
     */
67
    private $emails;
68
69
    /**
70
     *
71
     */
72 6
    public function __construct()
73
    {
74 6
        $this->state = self::DESIGN;
75 6
        $this->startDate = new \DateTime();
76 6
        $this->emails = [];
77 6
    }
78
79
    /**
80
     * @param string $name The name of the journey map.
81
     * @return self
82
     */
83 1
    public function setName($name)
84
    {
85 1
        $this->name = $name;
86
87 1
        return $this;
88
    }
89
90
    /**
91
     * @return string The name of the journey map.
92
     */
93 5
    public function getName()
94
    {
95 5
        return $this->name;
96
    }
97
98
    /**
99
     * @param string $state Possible values are Test, Active, Hold, Design. By default the value is set to Design.
100
     * @return self
101
     */
102 2
    public function setState($state)
103
    {
104
        $possible = array(
105 2
            self::TEST,
106 2
            self::ACTIVE,
107 2
            self::HOLD,
108 2
            self::DESIGN,
109
        );
110
111 2
        if (in_array($state, $possible)) {
112 1
            $this->state = $state;
113
        } else {
114 1
            throw new \InvalidArgumentException();
115
        }
116
117 1
        return $this;
118
    }
119
120
    /**
121
     * @return string Possible values are Test, Active, Hold, Design. By default the value is set to Design.
122
     */
123 5
    public function getState()
124
    {
125 5
        return $this->state;
126
    }
127
128
    /**
129
     * @param integer $id The ID of the folder in which the journey map is created.
130
     * @return self
131
     */
132 1
    public function setFolderId($id)
133
    {
134 1
        $this->folderId = $id;
135
136 1
        return $this;
137
    }
138
139
    /**
140
     * @return integer The ID of the folder in which the journey map is created.
141
     */
142 5
    public function getFolderId()
143
    {
144 5
        return $this->folderId;
145
    }
146
147
    /**
148
     * @param \DateTimeInterface $date This is the start date for the journey map.
149
     * @return self
150
     */
151 1
    public function setStartDate(\DateTimeInterface $date)
152
    {
153 1
        $this->startDate = $date;
154
155 1
        return $this;
156
    }
157
158
    /**
159
     * @return \DateTimeInterface This is the start date for the journey map.
160
     */
161 2
    public function getStartDate()
162
    {
163 2
        return $this->startDate;
164
    }
165
166
    /**
167
     * @param string $description The description of the journey map as defined in the properties.
168
     * @return self
169
     */
170 1
    public function setDescription($description)
171
    {
172 1
        $this->description = $description;
173
174 1
        return $this;
175
    }
176
177
    /**
178
     * @return string The description of the journey map as defined in the properties.
179
     */
180 5
    public function getDescription()
181
    {
182 5
        return $this->description;
183
    }
184
185
    /**
186
     * @param string $maCategory The category defined for the journey map, if any.
187
     * @return self
188
     */
189 1
    public function setMaCategory($maCategory)
190
    {
191 1
        $this->maCategory = $maCategory;
192
193 1
        return $this;
194
    }
195
196
    /**
197
     * @return string The category defined for the journey map, if any.
198
     */
199 5
    public function getMaCategory()
200
    {
201 5
        return $this->maCategory;
202
    }
203
204
    /**
205
     * @param integer $productId The ID of the product defined for the journey map, if any.
206
     * @return self
207
     */
208 1
    public function setProductId($productId)
209
    {
210 1
        $this->productId = $productId;
211
212 1
        return $this;
213
    }
214
215
    /**
216
     * @return integer The ID of the product defined for the journey map, if any.
217
     */
218 5
    public function getProductId()
219
    {
220 5
        return $this->productId;
221
    }
222
223
    /**
224
     * @param integer $clashPlanId The ID of the marketing pressure plan to which the journey map is linked.
225
     * @return self
226
     */
227 1
    public function setClashPlanId($clashPlanId)
228
    {
229 1
        $this->clashPlanId = $clashPlanId;
230
231 1
        return $this;
232
    }
233
    
234
    /**
235
     * @return integer The ID of the marketing pressure plan to which the journey map is linked.
236
     */
237 5
    public function getClashPlanId()
238
    {
239 5
        return $this->clashPlanId;
240
    }
241
242
    /**
243
     * @param Email $email
244
     * @return self
245
     */
246 2
    public function addEmail(Email $email)
247
    {
248 2
        $this->emails[] = $email;
249
250 2
        return $this;
251
    }
252
253
    /**
254
     * @return Email[]
255
     */
256 5
    public function getEmails()
257
    {
258 5
        return $this->emails;
259
    }
260
}
261