Test Failed
Push — master ( 614ce5...540a9b )
by Hannes
02:11
created

ExitStatusListener::onExample()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace hanneskod\readmetester\Console;
6
7
use hanneskod\readmetester\ListenerInterface;
8
use hanneskod\readmetester\Example\Example;
9
use hanneskod\readmetester\Expectation\Status;
10
11
/**
12
 * Capture exit status
13
 */
14
class ExitStatusListener implements ListenerInterface
15
{
16
    /**
17
     * @var int
18
     */
19
    private $exitStatus = 0;
20
21
    public function onExample(Example $example): void
22
    {
23
    }
24
25
    public function onIgnoredExample(Example $example): void
26
    {
27
    }
28
29
    public function onExpectation(Status $status): void
30
    {
31
        if (!$status->isSuccess()) {
32
            $this->exitStatus = 1;
33
        }
34
    }
35
36
    public function getStatusCode(): int
37
    {
38
        return $this->exitStatus;
39
    }
40
}
41