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

BooleanValue   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 32
rs 10
c 1
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A inProperty() 0 3 1
A withCustomTruths() 0 6 1
A inPropertyWithDifferentKey() 0 5 1
A withCustomTruthsAndKey() 0 9 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Stratadox\Hydration\Mapping\Simple\Type;
5
6
use Stratadox\Hydration\Mapping\DifferentKey;
7
use Stratadox\Hydration\Mapping\Primitive\BooleanMapping;
8
use Stratadox\HydrationMapping\Mapping;
9
10
final class BooleanValue
11
{
12
    public static function withCustomTruths(
13
        string $name,
14
        array $truths,
15
        array $falsehoods
16
    ): Mapping {
17
        return BooleanMapping::custom($name, $truths, $falsehoods);
18
    }
19
20
    public static function withCustomTruthsAndKey(
21
        string $name,
22
        string $key,
23
        array $truths,
24
        array $falsehoods
25
    ): Mapping {
26
        return DifferentKey::use(
27
            $key,
28
            BooleanMapping::custom($name, $truths, $falsehoods)
29
        );
30
    }
31
32
    public static function inProperty(string $name): Mapping
33
    {
34
        return BooleanMapping::inProperty($name);
35
    }
36
37
    public static function inPropertyWithDifferentKey(
38
        string $name,
39
        string $key
40
    ): Mapping {
41
        return DifferentKey::use($key, BooleanMapping::inProperty($name));
42
    }
43
}
44