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

Result   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 45%

Importance

Changes 0
Metric Value
dl 0
loc 49
ccs 9
cts 20
cp 0.45
rs 10
c 0
b 0
f 0
wmc 8
lcom 2
cbo 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A isSuccess() 0 4 1
A isError() 0 4 1
A params() 0 4 1
A param() 0 4 1
A errors() 0 4 1
A errorsText() 0 5 1
A pipeline() 0 4 1
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