RelationshipTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 10
ccs 0
cts 5
cp 0
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A getRelationships() 0 5 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Canvas\Contracts\Mapper;
6
7
trait RelationshipTrait
8
{
9
    /**
10
     *  Attach relationship to DTO.
11
     */
12
    protected function getRelationships(object $object, object $objectDto, array $relationships) : void
13
    {
14
        if (isset($relationships['relationships'])) {
15
            foreach ($relationships['relationships'] as $relationship) {
16
                $objectDto->$relationship = $object->$relationship;
17
            }
18
        }
19
    }
20
}
21