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

AlwaysThrowExceptionOnFailure::beforeStateChange()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 2
dl 0
loc 2
ccs 1
cts 1
cp 1
crap 1
rs 10
c 0
b 0
f 0
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