HasOneNested   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 20
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A inPropertyWithDifferentKey() 0 8 1
A inProperty() 0 7 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Stratadox\Hydration\Mapping\Simple\Relationship;
5
6
use Stratadox\Deserializer\Deserializer;
7
use Stratadox\Hydration\Mapping\Transform\NestingTransform;
8
use Stratadox\Hydration\Mapping\Relation\RelationMapping;
9
use Stratadox\HydrationMapping\Mapping;
10
11
final class HasOneNested
12
{
13
    public static function inProperty(
14
        string $name,
15
        Deserializer $deserializer
16
    ): Mapping {
17
        return NestingTransform::inKey($name, RelationMapping::inProperty(
18
            $name,
19
            $deserializer
20
        ));
21
    }
22
23
    public static function inPropertyWithDifferentKey(
24
        string $name,
25
        string $key,
26
        Deserializer $deserializer
27
    ): Mapping {
28
        return NestingTransform::inKey($key, RelationMapping::inProperty(
29
            $name,
30
            $deserializer
31
        ));
32
    }
33
}
34