Passed
Pull Request — master (#38)
by
unknown
02:06
created

Divider::toArray()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
nc 2
nop 0
dl 0
loc 11
ccs 4
cts 5
cp 0.8
crap 2.032
rs 10
c 1
b 0
f 0
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 1
    public function toArray()
30
    {
31
        $data = [
32 1
            'type' => $this->getType(),
33
        ];
34
35 1
        if ($this->getBlockId()) {
36
            $data['block_id'] = $this->getBlockId();
37
        }
38
39 1
        return $data;
40
    }
41
}
42