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

NullCallback   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
dl 0
loc 28
ccs 4
cts 6
cp 0.6667
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A afterStateChange() 0 2 1
A onFailure() 0 3 1
A beforeStateChange() 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 NullCallback implements TransitionCallback
9
{
10
    /**
11
     * @param mixed $context
12
     * @param StateMachine $machine
13
     */
14 1
    public function beforeStateChange($context, StateMachine $machine)
15
    {
16 1
    }
17
18
    /**
19
     * @param mixed $context
20
     * @param StateMachine $machine
21
     */
22
    public function afterStateChange($context, StateMachine $machine)
23
    {
24
    }
25
26
    /**
27
     * @param InvalidStateTransitionException $exception
28
     * @param mixed $context
29
     * @param StateMachine $machine
30
     *
31
     * @return string
32
     */
33 1
    public function onFailure(InvalidStateTransitionException $exception, $context, StateMachine $machine)
34
    {
35 1
        throw new \RuntimeException('Method ' . __METHOD__ . ' should never be called.');
36
    }
37
}
38