BooleanExpectations   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 40
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A isBool() 0 4 1
A isTrue() 0 4 1
A isFalse() 0 4 1
1
<?php
2
3
namespace Dgame\Expectation;
4
5
/**
6
 * Class BooleanExpectations
7
 * @package Dgame\Expectation
8
 */
9
final class BooleanExpectations extends ScalarExpectations
10
{
11
    /**
12
     * BooleanExpectations constructor.
13
     *
14
     * @param mixed $value
15
     */
16 3
    public function __construct($value)
17
    {
18 3
        if ($this->isBool($value)) {
19 3
            parent::__construct($value);
20
        }
21 3
    }
22
23
    /**
24
     * @param mixed $value
25
     *
26
     * @return bool
27
     */
28 3
    private function isBool($value): bool
29
    {
30 3
        return $this->approveIf(is_bool($value))->isApproved();
31
    }
32
33
    /**
34
     * @return BooleanExpectations
35
     */
36 1
    public function isTrue(): self
37
    {
38 1
        return $this->approveIf($this->value === true);
39
    }
40
41
    /**
42
     * @return BooleanExpectations
43
     */
44 1
    public function isFalse(): self
45
    {
46 1
        return $this->approveIf($this->value === false);
47
    }
48
}
49