Passed
Pull Request — master (#19)
by Yannick
02:27
created

AlwaysThrowExceptionOnFailure   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 29
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A beforeStateChange() 0 2 1
A onFailure() 0 3 1
A afterStateChange() 0 2 1
1
<?php
2
3
namespace Star\Component\State\Callbacks;
4
5
use Star\Component\State\InvalidStateTransitionException;
6
use Star\Component\State\StateMachine;
7
8
final class AlwaysThrowExceptionOnFailure implements TransitionCallback
9
{
10
    /**
11
     * @param mixed $context
12
     * @param StateMachine $machine
13
     */
14 28
    public function beforeStateChange($context, StateMachine $machine)
15
    {
16 28
    }
17
18
    /**
19
     * @param mixed $context
20
     * @param StateMachine $machine
21
     */
22 19
    public function afterStateChange($context, StateMachine $machine)
23
    {
24 19
    }
25
26
    /**
27
     * @param InvalidStateTransitionException $exception
28
     * @param mixed $context
29
     * @param StateMachine $machine
30
     *
31
     * @return string
32
     * @throws InvalidStateTransitionException
33
     */
34 9
    public function onFailure(InvalidStateTransitionException $exception, $context, StateMachine $machine)
35
    {
36 9
        throw $exception;
37
    }
38
}
39