RelationshipTrait::getRelationships()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
cc 3
eloc 3
c 0
b 0
f 0
nc 3
nop 3
dl 0
loc 5
ccs 0
cts 5
cp 0
crap 12
rs 10
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