Passed
Push — master ( 8ede22...b3e0ce )
by Alexander
02:27
created

Divider::toArray()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

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