HasManyNested   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A inProperty() 0 8 1
A inPropertyWithDifferentKey() 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\KeyTransform;
8
use Stratadox\Hydration\Mapping\Transform\NestingTransform;
9
use Stratadox\Hydration\Mapping\Relation\RelationCollectionMapping;
10
use Stratadox\HydrationMapping\Mapping;
11
12
final class HasManyNested
13
{
14
    public static function inProperty(
15
        string $name,
16
        Deserializer $collection,
17
        Deserializer $item
18
    ): Mapping {
19
        return NestingTransform::inKey(
20
            $name,
21
            RelationCollectionMapping::inProperty($name, $collection, $item)
22
        );
23
    }
24
25
    public static function inPropertyWithDifferentKey(
26
        string $name,
27
        string $key,
28
        Deserializer $collection,
29
        Deserializer $item
30
    ): Mapping {
31
        return KeyTransform::use($key, self::inProperty($name, $collection, $item));
32
    }
33
}
34