Passed
Push — master ( 01c6a8...5a4258 )
by Jesse
09:00
created

FloatValue::inPropertyWithDifferentKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 2
dl 0
loc 6
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace Stratadox\Hydration\Mapping\Property\Type;
5
6
use Stratadox\Hydration\Mapping\Composite\ConditionalMapping;
7
use Stratadox\Hydration\Mapping\DifferentKey;
8
use Stratadox\Hydration\Mapping\Primitive\FloatCheck;
9
use Stratadox\Hydration\Mapping\Primitive\FloatMapping;
10
use Stratadox\Hydration\Mapping\Property\Keyed;
11
use Stratadox\HydrationMapping\KeyedMapping;
12
13
final class FloatValue
14
{
15
    public static function inProperty(string $name): KeyedMapping
16
    {
17
        return Keyed::mapping($name,
18
            ConditionalMapping::ensureThat(FloatCheck::passes(), FloatMapping::inProperty($name))
19
        );
20
    }
21
22
    public static function inPropertyWithDifferentKey(
23
        string $name,
24
        string $key
25
    ): KeyedMapping {
26
        return Keyed::mapping($key, DifferentKey::use($key,
27
            ConditionalMapping::ensureThat(FloatCheck::passes(), FloatMapping::inProperty($name))
28
        ));
29
    }
30
}
31