Passed
Push — trunk ( d8cd01...b6c024 )
by Christian
13:44 queued 12s
created

IllegalTransitionException::getStatusCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Core\System\StateMachine\Exception;
4
5
use Shopware\Core\Framework\Log\Package;
6
use Shopware\Core\System\StateMachine\StateMachineException;
7
use Symfony\Component\HttpFoundation\Response;
8
9
#[Package('checkout')]
10
class IllegalTransitionException extends StateMachineException
11
{
12
    /**
13
     * @param array<mixed> $possibleTransitions
14
     */
15
    public function __construct(
16
        string $currentState,
17
        string $transition,
18
        array $possibleTransitions
19
    ) {
20
        parent::__construct(
21
            Response::HTTP_BAD_REQUEST,
22
            self::ILLEGAL_STATE_TRANSITION,
23
            'Illegal transition "{{ transition }}" from state "{{ currentState }}". Possible transitions are: {{ possibleTransitionsString }}',
24
            [
25
                'transition' => $transition,
26
                'currentState' => $currentState,
27
                'possibleTransitionsString' => implode(', ', $possibleTransitions),
28
                'possibleTransitions' => $possibleTransitions,
29
            ]
30
        );
31
    }
32
}
33