Test Failed
Push — master ( 397588...614ce5 )
by Hannes
02:13
created

ReturnOutcome::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 3
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace hanneskod\readmetester\Runner;
6
7
/**
8
 * Return value from an executed code block
9
 */
10
class ReturnOutcome implements OutcomeInterface
11
{
12
    /**
13
     * @var array
14
     */
15
    private $payload;
16
17
    public function __construct(string $value, string $type, string $class)
18
    {
19
        $this->payload = [
20
            'value' => $value,
21
            'type' => $type,
22
            'class' => $class
23
        ];
24
    }
25
26
    public function getType(): string
27
    {
28
        return self::TYPE_RETURN;
29
    }
30
31
    public function getPayload(): array
32
    {
33
        return $this->payload;
34
    }
35
36
    public function __tostring(): string
37
    {
38
        return "return value '{$this->payload['value']}'";
39
    }
40
}
41