Passed
Push — master ( c81968...b18996 )
by Maximilian
01:27 queued 12s
created

SerializeValueMapper::valueToArrayIfSet()   A

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
namespace MaxBeckers\AmazonAlexa\Helper;
4
5
/**
6
 * This trait is helpful for the property to ArrayObject mapping.
7
 *
8
 * @author Maximilian Beckers <[email protected]>
9
 */
10
trait SerializeValueMapper
11
{
12
    /**
13
     * @param \ArrayObject $data
14
     * @param string       $property
15
     */
16 17
    protected function valueToArrayIfSet(\ArrayObject $data, string $property)
17
    {
18 17
        if (null !== $this->{$property}) {
19 15
            $data[$property] = $this->{$property};
20
        }
21
    }
22
}
23