Passed
Push — master ( 606d11...57ef6f )
by Smoren
02:24
created

BoolRule::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 6
nc 1
nop 1
dl 0
loc 8
ccs 7
cts 7
cp 1
crap 1
rs 10
c 1
b 0
f 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Smoren\Validator\Rules;
6
7
use Smoren\Validator\Factories\CheckBuilder;
8
use Smoren\Validator\Interfaces\BoolRuleInterface;
9
use Smoren\Validator\Structs\CheckName;
10
11
class BoolRule extends MixedRule implements BoolRuleInterface
12
{
13
    /**
14
     * @param string $name
15
     */
16 22
    public function __construct(string $name)
17
    {
18 22
        parent::__construct($name);
19 22
        $this->check(
20 22
            CheckBuilder::create(CheckName::BOOL)
21 22
                ->withPredicate(fn ($value) => \is_bool($value))
22 22
                ->build(),
23 22
            true
24 22
        );
25
    }
26
}
27