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

FloatValue::value()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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