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

InvalidTransitionException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 0
loc 11
rs 9.4285
cc 1
eloc 7
nc 1
nop 2
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