Step   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 6
dl 0
loc 30
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A toString() 0 3 2
A check() 0 2 1
A __toString() 0 2 1
A isChecked() 0 2 1
1
<?php
2
3
namespace PHPKitchen\CodeSpecsCore\Expectation\Internal;
4
5
/**
6
 * Represents assert step of each expectaion.
7
 * Calling any if matcher assert methods produce new instance of this class.
8
 *
9
 * @package PHPKitchen\CodeSpecsCore\Module
10
 * @author Dmitry Kolodko <[email protected]>
11
 */
12
class Step {
13
    /**
14
     * @var string name of the step that would be used in error output.
15
     */
16
    private $name;
17
    /**
18
     * @var bool identifies whether step successfully passed or not.
19
     * Based on this value output of the step  would contain checked or not checked sigh.
20
     */
21
    private $checked = false;
22
23
    public function __construct($name) {
24
        $this->name = $name;
25
    }
26
27
    public function check() {
28
        $this->checked = true;
29
    }
30
31
    public function __toString() {
32
        return $this->toString();
33
    }
34
35
    public function toString() {
36
        $stepResult = $this->isChecked() ? "\u{2713} " : '- ';
37
        return $stepResult . $this->name;
38
    }
39
40
    protected function isChecked() {
41
        return $this->checked;
42
    }
43
}