Passed
Pull Request — master (#75)
by Nathan
05:29
created

EntitySlackNotification::hasCustomBot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * Copyright (C) 2018
5
 * Nathan Boiron <[email protected]>
6
 * Romain Canon <[email protected]>
7
 *
8
 * This file is part of the TYPO3 NotiZ project.
9
 * It is free software; you can redistribute it and/or modify it
10
 * under the terms of the GNU General Public License, either
11
 * version 3 of the License, or any later version.
12
 *
13
 * For the full copyright and license information, see:
14
 * http://www.gnu.org/licenses/gpl-3.0.html
15
 */
16
17
namespace CuyZ\Notiz\Domain\Notification\Slack\Application\EntitySlack;
18
19
use CuyZ\Notiz\Core\Notification\CustomSettingsNotification;
20
use CuyZ\Notiz\Domain\Notification\EntityNotification;
21
use CuyZ\Notiz\Domain\Notification\Slack\Application\EntitySlack\Processor\EntitySlackNotificationProcessor;
22
use CuyZ\Notiz\Domain\Notification\Slack\Application\EntitySlack\Settings\EntitySlackSettings;
23
use CuyZ\Notiz\Domain\Notification\Slack\SlackNotification;
24
25
class EntitySlackNotification extends EntityNotification implements SlackNotification, CustomSettingsNotification
26
{
27
    /**
28
     * @var string
29
     */
30
    protected $title;
31
32
    /**
33
     * @var string
34
     */
35
    protected $event;
36
37
    /**
38
     * @var string
39
     */
40
    protected $message;
41
42
    /**
43
     * @var bool
44
     */
45
    protected $customBot;
46
47
    /**
48
     * @var string
49
     */
50
    protected $bot;
51
52
    /**
53
     * @var string
54
     */
55
    protected $slackChannel;
56
57
    /**
58
     * @var string
59
     */
60
    protected $target;
61
62
    /**
63
     * @var string
64
     */
65
    protected $webhookUrl;
66
67
    /**
68
     * @var string
69
     */
70
    protected $name;
71
72
    /**
73
     * @var string
74
     */
75
    protected $avatar;
76
77
    /**
78
     * @return string
79
     */
80
    public function getTitle()
81
    {
82
        return $this->title;
83
    }
84
85
    /**
86
     * @param string $title
87
     */
88
    public function setTitle($title)
89
    {
90
        $this->title = $title;
91
    }
92
93
    /**
94
     * @return string
95
     */
96
    public function getEvent()
97
    {
98
        return $this->event;
99
    }
100
101
    /**
102
     * @param string $event
103
     */
104
    public function setEvent($event)
105
    {
106
        $this->event = $event;
107
    }
108
109
    /**
110
     * @return string
111
     */
112
    public function getMessage()
113
    {
114
        return $this->message;
115
    }
116
117
    /**
118
     * @param string $message
119
     */
120
    public function setMessage($message)
121
    {
122
        $this->message = $message;
123
    }
124
125
    /**
126
     * @return bool
127
     */
128
    public function hasCustomBot()
129
    {
130
        return $this->customBot;
131
    }
132
133
    /**
134
     * @param bool $customBot
135
     */
136
    public function setCustomBot($customBot)
137
    {
138
        $this->customBot = $customBot;
139
    }
140
141
    /**
142
     * @return string
143
     */
144
    public function getBot()
145
    {
146
        return $this->bot;
147
    }
148
149
    /**
150
     * @param string $bot
151
     */
152
    public function setBot($bot)
153
    {
154
        $this->bot = $bot;
155
    }
156
157
    /**
158
     * @return bool
159
     */
160
    public function hasCustomSlackChannel()
161
    {
162
        return !empty($this->target) || !empty($this->webhookUrl);
163
    }
164
165
    /**
166
     * @return string
167
     */
168
    public function getSlackChannel()
169
    {
170
        return $this->slackChannel;
171
    }
172
173
    /**
174
     * @param string $slackChannel
175
     */
176
    public function setSlackChannel($slackChannel)
177
    {
178
        $this->slackChannel = $slackChannel;
179
    }
180
181
    /**
182
     * @return string
183
     */
184
    public function getWebhookUrl()
185
    {
186
        return $this->webhookUrl;
187
    }
188
189
    /**
190
     * @param string $webhookUrl
191
     */
192
    public function setWebhookUrl($webhookUrl)
193
    {
194
        $this->webhookUrl = $webhookUrl;
195
    }
196
197
    /**
198
     * @return string
199
     */
200
    public function getTarget()
201
    {
202
        return $this->target;
203
    }
204
205
    /**
206
     * @param string $target
207
     */
208
    public function setTarget($target)
209
    {
210
        $this->target = $target;
211
    }
212
213
    /**
214
     * @return string
215
     */
216
    public function getName()
217
    {
218
        return $this->name;
219
    }
220
221
    /**
222
     * @param string $name
223
     */
224
    public function setName($name)
225
    {
226
        $this->name = $name;
227
    }
228
229
    /**
230
     * @return string
231
     */
232
    public function getAvatar()
233
    {
234
        return $this->avatar;
235
    }
236
237
    /**
238
     * @param string $avatar
239
     */
240
    public function setAvatar($avatar)
241
    {
242
        $this->avatar = $avatar;
243
    }
244
245
    /**
246
     * @return string
247
     */
248
    public static function getProcessorClassName()
249
    {
250
        return EntitySlackNotificationProcessor::class;
251
    }
252
253
    /**
254
     * @return string
255
     */
256
    public static function getSettingsClassName()
257
    {
258
        return EntitySlackSettings::class;
259
    }
260
}
261