Overflow::toArray()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 7
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 13
ccs 8
cts 8
cp 1
crap 2
rs 10
1
<?php
2
namespace Maknz\Slack\BlockElement;
3
4
class Overflow extends Options
5
{
6
    /**
7
     * Block type.
8
     *
9
     * @var string
10
     */
11
    protected $type = 'overflow';
12
13
    /**
14
     * Internal attribute to property map.
15
     *
16
     * @var array
17
     */
18
    protected static $availableAttributes = [
19
        'action_id' => 'action_id',
20
        'options'   => 'options',
21
        'confirm'   => 'confirm',
22
    ];
23
24
    /**
25
     * Convert the block to its array representation.
26
     *
27
     * @return array
28
     */
29 1
    public function toArray()
30
    {
31 1
        $data = [
32 1
            'type'      => $this->getType(),
33 1
            'action_id' => $this->getActionId(),
34 1
            'options'   => $this->getOptionsAsArrays(),
35
        ];
36
37 1
        if ($this->getConfirm()) {
38 1
            $data['confirm'] = $this->getConfirm()->toArray();
39
        }
40
41 1
        return $data;
42
    }
43
}
44