Passed
Push — master ( f5f62a...783e97 )
by Christian
12:34 queued 10s
created

PatternNotComplexEnoughException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 19
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getStatusCode() 0 3 1
A getErrorCode() 0 3 1
A __construct() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Core\Checkout\Promotion\Exception;
4
5
use Shopware\Core\Framework\ShopwareHttpException;
6
use Symfony\Component\HttpFoundation\Response;
7
8
class PatternNotComplexEnoughException extends ShopwareHttpException
9
{
10
    public const ERROR_CODE = 'PROMOTION__INDIVIDUAL_CODES_PATTERN_INSUFFICIENTLY_COMPLEX';
11
12
    public function __construct()
13
    {
14
        parent::__construct(
15
            'The amount of possible codes is too low for the current pattern. Make sure your pattern is sufficiently complex.'
16
        );
17
    }
18
19
    public function getErrorCode(): string
20
    {
21
        return self::ERROR_CODE;
22
    }
23
24
    public function getStatusCode(): int
25
    {
26
        return Response::HTTP_BAD_REQUEST;
27
    }
28
}
29