Completed
Push — master ( 745e1e...09b728 )
by Alexey
04:01
created

SlackMessage::setQuoteTitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * This file is part of the WoW-Apps/Symfony-Slack-Bot bundle for Symfony 3
4
 * https://github.com/wow-apps/symfony-slack-bot
5
 *
6
 * (c) 2016 WoW-Apps
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WowApps\SlackBundle\DTO;
13
14
use WowApps\SlackBundle\Traits\SlackMessageTrait;
15
16
/**
17
 * Class SlackMessage
18
 *
19
 * @author Alexey Samara <[email protected]>
20
 * @package WowApps\SlackBundle
21
 */
22
class SlackMessage
23
{
24
    use SlackMessageTrait;
25
26
    /** @var string */
27
    private $icon;
28
29
    /** @var string */
30
    private $text;
31
32
    /** @var int */
33
    private $quoteType;
34
35
    /** @var string */
36
    private $quoteTitle;
37
38
    /** @var string */
39
    private $quoteTitleLink;
40
41
    /** @var string */
42
    private $quoteText;
43
44
    /** @var bool */
45
    private $showQuote;
46
47
    /** @var string */
48
    private $recipient;
49
50
    /** @var string */
51
    private $sender;
52
53
    /**
54
     * SlackMessage constructor.
55
     * @param string $icon
56
     * @param string $text
57
     * @param int $quoteType
58
     * @param string $quoteTitle
59
     * @param string $quoteTitleLink
60
     * @param string $quoteText
61
     * @param bool $showQuote
62
     * @param string $recipient
63
     * @param string $sender
64
     */
65 9
    public function __construct(
66
        string  $icon = '',
67
        string  $text = '',
68
        int     $quoteType = 0,
69
        string  $quoteTitle = '',
70
        string  $quoteTitleLink = '',
71
        string  $quoteText = '',
72
        bool    $showQuote = false,
73
        string  $recipient = '',
74
        string  $sender = ''
75
    ) {
76
        $this
77 9
            ->setIcon($icon)
78 9
            ->setText($text)
79 9
            ->setQuoteType($quoteType)
80 9
            ->setQuoteTitle($quoteTitle)
81 9
            ->setQuoteTitleLink($quoteTitleLink)
82 9
            ->setQuoteText($quoteText)
83 9
            ->setShowQuote($showQuote)
84 9
            ->setRecipient($recipient)
85 9
            ->setSender($sender)
86
        ;
87 9
    }
88
89
    /**
90
     * @return string
91
     */
92 1
    public function getIcon(): string
93
    {
94 1
        return $this->icon;
95
    }
96
97
    /**
98
     * @param string $icon
99
     * @return SlackMessage
100
     */
101 9
    public function setIcon(string $icon)
102
    {
103 9
        $this->icon = $icon;
104 9
        return $this;
105
    }
106
107
    /**
108
     * @return string
109
     */
110 1
    public function getText(): string
111
    {
112 1
        return $this->text;
113
    }
114
115
    /**
116
     * @param string $text
117
     * @return SlackMessage
118
     */
119 9
    public function setText(string $text)
120
    {
121 9
        $this->text = $this->escapeCharacters($text);
122 9
        return $this;
123
    }
124
125
    /**
126
     * @return int
127
     */
128 1
    public function getQuoteType(): int
129
    {
130 1
        return $this->quoteType;
131
    }
132
133
    /**
134
     * @param int $quoteType
135
     * @return SlackMessage
136
     */
137 9
    public function setQuoteType(int $quoteType)
138
    {
139 9
        $this->quoteType = $quoteType;
140 9
        return $this;
141
    }
142
143
    /**
144
     * @return string
145
     */
146 1
    public function getQuoteTitle(): string
147
    {
148 1
        return $this->quoteTitle;
149
    }
150
151
    /**
152
     * @param string $quoteTitle
153
     * @return SlackMessage
154
     */
155 9
    public function setQuoteTitle(string $quoteTitle)
156
    {
157 9
        $this->quoteTitle = $this->escapeCharacters($quoteTitle);
158 9
        return $this;
159
    }
160
161
    /**
162
     * @return string
163
     */
164 1
    public function getQuoteTitleLink(): string
165
    {
166 1
        return $this->quoteTitleLink;
167
    }
168
169
    /**
170
     * @param string $quoteTitleLink
171
     * @return SlackMessage
172
     */
173 9
    public function setQuoteTitleLink(string $quoteTitleLink)
174
    {
175 9
        $this->quoteTitleLink = $this->escapeCharacters($quoteTitleLink);
176 9
        return $this;
177
    }
178
179
    /**
180
     * @return string
181
     */
182 1
    public function getQuoteText(): string
183
    {
184 1
        return $this->quoteText;
185
    }
186
187
    /**
188
     * @param string $quoteText
189
     * @return SlackMessage
190
     */
191 9
    public function setQuoteText(string $quoteText)
192
    {
193 9
        $this->quoteText = $this->escapeCharacters($quoteText);
194 9
        return $this;
195
    }
196
197
    /**
198
     * @return bool
199
     */
200 1
    public function isShowQuote(): bool
201
    {
202 1
        return $this->showQuote;
203
    }
204
205
    /**
206
     * @param bool $showQuote
207
     * @return SlackMessage
208
     */
209 9
    public function setShowQuote(bool $showQuote)
210
    {
211 9
        $this->showQuote = $showQuote;
212 9
        return $this;
213
    }
214
215
    /**
216
     * @return string
217
     */
218 1
    public function getRecipient(): string
219
    {
220 1
        return $this->recipient;
221
    }
222
223
    /**
224
     * @param string $recipient
225
     * @return SlackMessage
226
     */
227 9
    public function setRecipient(string $recipient)
228
    {
229 9
        $this->recipient = $this->escapeCharacters($recipient);
230 9
        return $this;
231
    }
232
233
    /**
234
     * @return string
235
     */
236 1
    public function getSender(): string
237
    {
238 1
        return $this->sender;
239
    }
240
241
    /**
242
     * @param string $sender
243
     * @return SlackMessage
244
     */
245 9
    public function setSender(string $sender)
246
    {
247 9
        $this->sender = $this->escapeCharacters($sender);
248 9
        return $this;
249
    }
250
}
251