Completed
Pull Request — master (#38)
by
unknown
03:25
created

Confirmation::getTitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
namespace Maknz\Slack\Object;
3
4
use InvalidArgumentException;
5
use Maknz\Slack\BlockElement\Text;
6
7
class Confirmation extends CompositionObject
8
{
9
    /**
10
     * Confirmation title.
11
     *
12
     * @var Maknz\Slack\BlockElement\Text
0 ignored issues
show
Bug introduced by
The type Maknz\Slack\Object\Maknz\Slack\BlockElement\Text was not found. Did you mean Maknz\Slack\BlockElement\Text? If so, make sure to prefix the type with \.
Loading history...
13
     */
14
    protected $title;
15
16
    /**
17
     * Confirmation explanatory text.
18
     *
19
     * @var Maknz\Slack\BlockElement\Text
20
     */
21
    protected $text;
22
23
    /**
24
     * Text that confirms the action.
25
     *
26
     * @var Maknz\Slack\BlockElement\Text
27
     */
28
    protected $confirm;
29
30
    /**
31
     * Text that denies the action.
32
     *
33
     * @var Maknz\Slack\BlockElement\Text
34
     */
35
    protected $deny;
36
37
    /**
38
     * Internal attribute to property map.
39
     *
40
     * @var array
41
     */
42
    protected static $availableAttributes = [
43
        'title'   => 'title',
44
        'text'    => 'text',
45
        'confirm' => 'confirm',
46
        'deny'    => 'deny',
47
    ];
48
49
    /**
50
     * Get the confirmation title.
51
     *
52
     * @return Maknz\Slack\BlockElement\Text
53
     */
54 9
    public function getTitle()
55
    {
56 9
        return $this->title;
57
    }
58
59
    /**
60
     * Set the confirmation title.
61
     *
62
     * @param mixed $title
63
     *
64
     * @return Confirmation
65
     *
66
     * @throws \InvalidArgumentException
67
     */
68 9
    public function setTitle($title)
69
    {
70 9
        $this->title = Text::create($title, Text::TYPE_PLAIN);
0 ignored issues
show
Documentation Bug introduced by
It seems like Maknz\Slack\BlockElement...ement\Text::TYPE_PLAIN) of type Maknz\Slack\BlockElement\Text is incompatible with the declared type Maknz\Slack\Object\Maknz\Slack\BlockElement\Text of property $title.

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...
71
72 9
        return $this;
73
    }
74
75
    /**
76
     * Get the confirmation explanatory text.
77
     *
78
     * @return Maknz\Slack\BlockElement\Text
79
     */
80 9
    public function getText()
81
    {
82 9
        return $this->text;
83
    }
84
85
    /**
86
     * Set the confirmation explanatory text.
87
     *
88
     * @param mixed $text
89
     *
90
     * @return Confirmation
91
     *
92
     * @throws \InvalidArgumentException
93
     */
94 9
    public function setText($text)
95
    {
96 9
        $this->text = Text::create($text);
0 ignored issues
show
Documentation Bug introduced by
It seems like Maknz\Slack\BlockElement\Text::create($text) of type Maknz\Slack\BlockElement\Text is incompatible with the declared type Maknz\Slack\Object\Maknz\Slack\BlockElement\Text of property $text.

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...
97
98 9
        return $this;
99
    }
100
101
    /**
102
     * Get the text that confirms the action.
103
     *
104
     * @return Maknz\Slack\BlockElement\Text
105
     */
106 9
    public function getConfirm()
107
    {
108 9
        return $this->confirm;
109
    }
110
111
    /**
112
     * Set the text that confirms the action.
113
     *
114
     * @param mixed $confirm
115
     *
116
     * @return Confirmation
117
     *
118
     * @throws \InvalidArgumentException
119
     */
120 9
    public function setConfirm($confirm)
121
    {
122 9
        $this->confirm = Text::create($confirm, Text::TYPE_PLAIN);
0 ignored issues
show
Documentation Bug introduced by
It seems like Maknz\Slack\BlockElement...ement\Text::TYPE_PLAIN) of type Maknz\Slack\BlockElement\Text is incompatible with the declared type Maknz\Slack\Object\Maknz\Slack\BlockElement\Text of property $confirm.

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...
123
124 9
        return $this;
125
    }
126
127
    /**
128
     * Get the text that denies the action.
129
     *
130
     * @return Maknz\Slack\BlockElement\Text
131
     */
132 9
    public function getDeny()
133
    {
134 9
        return $this->deny;
135
    }
136
137
    /**
138
     * Set the text that denies the action.
139
     *
140
     * @param mixed $deny
141
     *
142
     * @return Confirmation
143
     *
144
     * @throws \InvalidArgumentException
145
     */
146 9
    public function setDeny($deny)
147
    {
148 9
        $this->deny = Text::Create($deny, Text::TYPE_PLAIN);
0 ignored issues
show
Documentation Bug introduced by
It seems like Maknz\Slack\BlockElement...ement\Text::TYPE_PLAIN) of type Maknz\Slack\BlockElement\Text is incompatible with the declared type Maknz\Slack\Object\Maknz\Slack\BlockElement\Text of property $deny.

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...
149
150 9
        return $this;
151
    }
152
153
    /**
154
     * Convert the block to its array representation.
155
     *
156
     * @return array
157
     */
158 9
    public function toArray()
159
    {
160
        $data = [
161 9
            'title'   => $this->getTitle()->toArray(),
162 9
            'text'    => $this->getText()->toArray(),
163 9
            'confirm' => $this->getConfirm()->toArray(),
164 9
            'deny'    => $this->getDeny()->toArray(),
165
        ];
166
167 9
        return $data;
168
    }
169
}
170