Test Failed
Push — ft/states ( eebc9c )
by Ben
29:42 queued 08:49
created

StateException::invalidTransition()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 3
1
<?php
2
3
namespace Thinktomorrow\Chief\States\State;
4
5
class StateException extends \Exception
6
{
7
    public static function invalidState($state, $currentState, $stateMachine)
8
    {
9
        return new self('Transition to state ['.$state.'] is not allowed from state ['.$currentState.'] or state does not exist on '.get_class($stateMachine));
10
    }
11
12
    public static function malformedTransition($transition, $stateMachine)
13
    {
14
        return new self('Transition ['.$transition.'] is malformed on '.get_class($stateMachine).'. It should contain both a [from:array] and [to:string] value.');
15
    }
16
17
    public static function invalidTransitionKey($transition, $stateMachine)
18
    {
19
        return new self('unknown transition ['.$transition.'] on '.get_class($stateMachine));
20
    }
21
22
    public static function invalidTransition($transition, $state, $stateMachine)
23
    {
24
        return new self('Transition ['.$transition.'] cannot be applied from current state ['.$state.'] on '.get_class($stateMachine));
25
    }
26
27
    public static function invalidTransitionState($transition, $state, $stateMachine)
28
    {
29
        return new self('Transition ['.$transition.'] contains a non existing ['.$state.'] on '.get_class($stateMachine));
30
    }
31
}
32