Completed
Push — master ( b70f30...259e2d )
by Kamil
32:06
created

InvalidTransitionException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 1
c 2
b 1
f 0
lcom 0
cbo 2
dl 0
loc 18
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Component\Core\Exception;
13
14
use SM\SMException;
15
use SM\StateMachine\StateMachineInterface;
16
17
/**
18
 * @author Mateusz Zalewski <[email protected]>
19
 */
20
class InvalidTransitionException extends SMException
21
{
22
    /**
23
     * @param string $transition
24
     * @param StateMachineInterface $stateMachine
25
     */
26
    public function __construct($transition, StateMachineInterface $stateMachine)
27
    {
28
        parent::__construct(
29
            sprintf(
30
                'Transition "%s" is invalid for "%s" state machine. Possible transitions are: %s.',
31
                $transition,
32
                $stateMachine->getGraph(),
33
                implode($stateMachine->getPossibleTransitions(), ' and ')
34
            )
35
        );
36
    }
37
}
38