Test Failed
Push — master ( b1e763...e9b74b )
by Hannes
02:19
created

ErrorOutcome   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 3 1
A getPayload() 0 3 1
A __tostring() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace hanneskod\readmetester\Runner;
6
7
/**
8
 * Output from an executed code block
9
 */
10
class ErrorOutcome implements OutcomeInterface
11
{
12
    /**
13
     * @var string
14
     */
15
    private $message;
16
17
    public function __construct(string $message)
18
    {
19
        $this->message = $message;
20
    }
21
22
    public function getType(): string
23
    {
24
        return self::TYPE_ERROR;
25
    }
26
27
    public function getPayload(): array
28
    {
29
        return ['error' => $this->message];
30
    }
31
32
    public function __tostring(): string
33
    {
34
        return $this->message;
35
    }
36
}
37