Mapping   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A map() 0 8 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Genkgo\Camt\Decoder\Factory\DTO\Behavior;
6
7
use SimpleXMLElement;
8
9
trait Mapping
10
{
11
    /**
12
     * @param string[][] $mapping
13
     */
14 23
    public static function map(object $object, SimpleXMLElement $xml, array $mapping): void
15
    {
16 23
        foreach ($mapping as $line) {
17 23
            $setter = $line['setter'];
18 23
            $xmlValue = $line['value'];
19
20 23
            if (isset($xml->$xmlValue)) {
21 23
                $object->$setter((string) $xml->$xmlValue);
22
            }
23
        }
24 23
    }
25
}
26