Passed
Pull Request — master (#38)
by
unknown
02:06
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 Maknz\Slack\BlockElement\Text;
5
6
class Confirmation extends CompositionObject
7
{
8
    /**
9
     * Confirmation title.
10
     *
11
     * @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...
12
     */
13
    protected $title;
14
15
    /**
16
     * Confirmation explanatory text.
17
     *
18
     * @var Maknz\Slack\BlockElement\Text
19
     */
20
    protected $text;
21
22
    /**
23
     * Text that confirms the action.
24
     *
25
     * @var Maknz\Slack\BlockElement\Text
26
     */
27
    protected $confirm;
28
29
    /**
30
     * Text that denies the action.
31
     *
32
     * @var Maknz\Slack\BlockElement\Text
33
     */
34
    protected $deny;
35
36
    /**
37
     * Internal attribute to property map.
38
     *
39
     * @var array
40
     */
41
    protected static $availableAttributes = [
42
        'title'   => 'title',
43
        'text'    => 'text',
44
        'confirm' => 'confirm',
45
        'deny'    => 'deny',
46
    ];
47
48
    /**
49
     * Get the confirmation title.
50
     *
51
     * @return Maknz\Slack\BlockElement\Text
52
     */
53 9
    public function getTitle()
54
    {
55 9
        return $this->title;
56
    }
57
58
    /**
59
     * Set the confirmation title.
60
     *
61
     * @param mixed $title
62
     *
63
     * @return Confirmation
64
     *
65
     * @throws \InvalidArgumentException
66
     */
67 9
    public function setTitle($title)
68
    {
69 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...
70
71 9
        return $this;
72
    }
73
74
    /**
75
     * Get the confirmation explanatory text.
76
     *
77
     * @return Maknz\Slack\BlockElement\Text
78
     */
79 9
    public function getText()
80
    {
81 9
        return $this->text;
82
    }
83
84
    /**
85
     * Set the confirmation explanatory text.
86
     *
87
     * @param mixed $text
88
     *
89
     * @return Confirmation
90
     *
91
     * @throws \InvalidArgumentException
92
     */
93 9
    public function setText($text)
94
    {
95 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...
96
97 9
        return $this;
98
    }
99
100
    /**
101
     * Get the text that confirms the action.
102
     *
103
     * @return Maknz\Slack\BlockElement\Text
104
     */
105 9
    public function getConfirm()
106
    {
107 9
        return $this->confirm;
108
    }
109
110
    /**
111
     * Set the text that confirms the action.
112
     *
113
     * @param mixed $confirm
114
     *
115
     * @return Confirmation
116
     *
117
     * @throws \InvalidArgumentException
118
     */
119 9
    public function setConfirm($confirm)
120
    {
121 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...
122
123 9
        return $this;
124
    }
125
126
    /**
127
     * Get the text that denies the action.
128
     *
129
     * @return Maknz\Slack\BlockElement\Text
130
     */
131 9
    public function getDeny()
132
    {
133 9
        return $this->deny;
134
    }
135
136
    /**
137
     * Set the text that denies the action.
138
     *
139
     * @param mixed $deny
140
     *
141
     * @return Confirmation
142
     *
143
     * @throws \InvalidArgumentException
144
     */
145 9
    public function setDeny($deny)
146
    {
147 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...
148
149 9
        return $this;
150
    }
151
152
    /**
153
     * Convert the block to its array representation.
154
     *
155
     * @return array
156
     */
157 9
    public function toArray()
158
    {
159
        $data = [
160 9
            'title'   => $this->getTitle()->toArray(),
161 9
            'text'    => $this->getText()->toArray(),
162 9
            'confirm' => $this->getConfirm()->toArray(),
163 9
            'deny'    => $this->getDeny()->toArray(),
164
        ];
165
166 9
        return $data;
167
    }
168
}
169