Success   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 7
dl 0
loc 27
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A finalState() 0 6 2
A throwFailures() 0 4 1
A __construct() 0 3 1
1
<?php
2
3
namespace MeadSteve\Tale\Execution;
4
5
use MeadSteve\Tale\State\CloneableState;
6
7
class Success implements TransactionResult
8
{
9
    /**
10
     * @var mixed whatever the state of running the transaction was
11
     */
12
    private $finalState;
13
14
    /**
15
     * @param mixed $finalState whatever the state of running the transaction was
16
     */
17
    public function __construct($finalState)
18
    {
19
        $this->finalState = $finalState;
20
    }
21
22
    public function throwFailures()
23
    {
24
        // Nothing to be thrown as this is a success
25
        return $this;
26
    }
27
28
    public function finalState()
29
    {
30
        if ($this->finalState instanceof CloneableState) {
31
            return $this->finalState->cloneState();
32
        }
33
        return $this->finalState;
34
    }
35
}
36