HasManyNested::inProperty()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 8
rs 10
c 0
b 0
f 0
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