DefaultConfiguration   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 27
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A defaultStrict() 0 3 1
A defaultValue() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace InputGuard;
5
6
use InputGuard\Guards\InListGuard;
7
8
class DefaultConfiguration implements Configuration
9
{
10
    /**
11
     * @var string[] Key: A fully qualified class name of a valadatable object. Value: The default value.
12
     */
13
    protected $defaultValues = [];
14
15
    /**
16
     * @var bool
17
     */
18
    protected $defaultStrictTypeComparision = false;
19
20
    /**
21
     * @var bool[]
22
     */
23
    protected $strictTypeComparisionOverride = [
24
        InListGuard::class => true,
25
    ];
26
27 66
    public function defaultValue(string $class)
28
    {
29 66
        return $this->defaultValues[$class] ?? null;
30
    }
31
32 26
    public function defaultStrict(string $class = ''): bool
33
    {
34 26
        return $this->strictTypeComparisionOverride[$class] ?? $this->defaultStrictTypeComparision;
35
    }
36
}
37