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

SerializeValueMapper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 3
c 1
b 0
f 0
dl 0
loc 10
ccs 3
cts 3
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A valueToArrayIfSet() 0 4 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