SerializeValueMapper::valueToArrayIfSet()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 2
nc 2
nop 2
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MaxBeckers\AmazonAlexa\Helper;
6
7
/**
8
 * This trait is helpful for the property to ArrayObject mapping.
9
 */
10
trait SerializeValueMapper
11
{
12 17
    protected function valueToArrayIfSet(\ArrayObject $data, string $property): void
13
    {
14 17
        if (null !== $this->{$property}) {
15 15
            $data[$property] = $this->{$property};
16
        }
17
    }
18
}
19