IntGuard::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace InputGuard\Guards;
5
6
use InputGuard\Guards\Bases\IntBase;
7
use InputGuard\Guards\Bases\SingleInput;
8
9
class IntGuard implements Guard
10
{
11
    use ErrorMessagesBase;
12
    use IntBase;
13
    use SingleInput;
14
15 11
    public function __construct($input, ?int $default = null)
16
    {
17 11
        $this->input = $input;
18 11
        $this->value = $default;
19 11
    }
20
21 4
    public function value(): ?int
22
    {
23 4
        $this->success();
24
25 4
        return $this->value;
26
    }
27
}
28