HasManyProxies   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

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

2 Methods

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