serializeMultiChildProperties()   A
last analyzed

Complexity

Conditions 6
Paths 8

Size

Total Lines 17
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 6.0493

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 6
eloc 8
c 1
b 0
f 1
nc 8
nop 0
dl 0
loc 17
ccs 8
cts 9
cp 0.8889
crap 6.0493
rs 9.2222
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\Component\Traits;
6
7
use MaxBeckers\AmazonAlexa\Response\Directives\APL\Component\APLBaseComponent;
8
9
trait MultiChildComponentTrait
10
{
11
    public ?array $data = null;
12
    /** @var APLBaseComponent|APLBaseComponent[]|null */
13
    public $item = null;
14
    /** @var APLBaseComponent[]|null */
15
    public ?array $items = null;
16
17 25
    protected function serializeMultiChildProperties(): array
18
    {
19 25
        $data = [];
20
21 25
        if ($this->data !== null && !empty($this->data)) {
22
            $data['data'] = $this->data;
23
        }
24
25 25
        if ($this->item !== null) {
26 1
            $data['item'] = $this->item;
27
        }
28
29 25
        if ($this->items !== null && !empty($this->items)) {
30 1
            $data['items'] = $this->items;
31
        }
32
33 25
        return $data;
34
    }
35
}
36