Passed
Push — master ( 924412...d4b74b )
by Jesse
02:02
created

IntegerValue::inProperty()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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