BooleanNode   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 0
cbo 4
dl 0
loc 26
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A nullable() 0 5 1
1
<?php
2
3
namespace Weew\ConfigSchema\Nodes;
4
5
use Weew\ConfigSchema\IConfigSchema;
6
use Weew\Validator\Constraints\BooleanConstraint;
7
use Weew\Validator\Constraints\NotNullConstraint;
8
use Weew\Validator\Constraints\NullableConstraint;
9
10
class BooleanNode extends Node implements IBooleanNode {
11
    /**
12
     * BooleanNode constructor.
13
     *
14
     * @param IConfigSchema $schema
15
     * @param string $key
16
     * @param string $message
17
     */
18
    public function __construct(IConfigSchema $schema, $key, $message = null) {
19
        parent::__construct($schema, $key);
20
21
        $this->constraints([
22
            new NotNullConstraint($message),
23
            new BooleanConstraint(),
24
        ]);
25
    }
26
27
    /**
28
     * @return IBooleanNode
29
     */
30
    public function nullable() {
31
        return $this->constraint(
32
            new NullableConstraint()
33
        );
34
    }
35
}
36
37