Completed
Push — master ( 75d280...2d4629 )
by Ievgen
08:05
created

Result::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 3
dl 0
loc 6
ccs 5
cts 5
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace einfach\operation;
4
5
class Result
6
{
7
    protected $params;
8
    protected $finalTrack;
9
    protected $pipeline;
10
11 1
    public function __construct($params, $finalTrack, $pipeline)
12
    {
13 1
        $this->params = $params;
14 1
        $this->finalTrack = $finalTrack;
15 1
        $this->pipeline = $pipeline;
16 1
    }
17
18 1
    public function isSuccess()
19
    {
20 1
        return $this->finalTrack == Railway::TRACK_SUCCESS;
21
    }
22
23
    public function isError()
24
    {
25
        return $this->finalTrack == Railway::TRACK_FAILURE;
26
    }
27
28 1
    public function params()
29
    {
30 1
        return $this->params;
31
    }
32
33
    public function param($name)
34
    {
35
        return $this->params[$name];
36
    }
37
38
    public function errors()
39
    {
40
        return $this->params['errors'];
41
    }
42
43
    public function errorsText($glue = '.')
44
    {
45
        print_r($this->params);
46
        return implode($glue, $this->params['errors']);
47
    }
48
49
    public function pipeline()
50
    {
51
        return $this->pipeline;
52
    }
53
}
54