Test Failed
Pull Request — master (#160)
by Maximo
06:15
created

RelationshipTrait::getRelationships()   A

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 1
Bugs 0 Features 1
Metric Value
cc 3
eloc 3
c 1
b 0
f 1
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
    private function getRelationships(object $object, object $objectDto, array $relationships): void
13
    {
14
        if (array_key_exists('relationships', $relationships)) {
15
            foreach ($relationships['relationships'] as $relationship) {
16
                $objectDto->$relationship = $object->$relationship;
17
            }
18
        }
19
    }
20
}
21