Passed
Push — master ( 3c3598...bb5c48 )
by Christian
12:33 queued 10s
created

OrderInconsistentException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 30
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getOrderId() 0 3 1
A __construct() 0 8 1
A getStatusCode() 0 3 1
A getErrorCode() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Core\Checkout\Cart\Exception;
4
5
use Shopware\Core\Framework\ShopwareHttpException;
6
use Symfony\Component\HttpFoundation\Response;
7
8
class OrderInconsistentException extends ShopwareHttpException
9
{
10
    /**
11
     * @var string
12
     */
13
    private $orderId;
14
15
    public function __construct(string $orderId, string $reason)
16
    {
17
        parent::__construct(
18
            'Inconsistent order with id "{{ orderId }}". Reason: {{ reason }}',
19
            ['orderId' => $orderId, 'reason' => $reason]
20
        );
21
22
        $this->orderId = $orderId;
23
    }
24
25
    public function getErrorCode(): string
26
    {
27
        return 'CHECKOUT__ORDER_INCONSISTENT';
28
    }
29
30
    public function getStatusCode(): int
31
    {
32
        return Response::HTTP_BAD_REQUEST;
33
    }
34
35
    public function getOrderId(): string
36
    {
37
        return $this->orderId;
38
    }
39
}
40