Passed
Push — master ( 72b2aa...c8dd73 )
by Christian
13:52 queued 11s
created

FeatureActiveException::getStatusCode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Core\Framework\Feature\Exception;
4
5
use Shopware\Core\Framework\ShopwareHttpException;
6
use Symfony\Component\HttpFoundation\Response;
7
8
class FeatureActiveException extends ShopwareHttpException
9
{
10
    public function __construct(string $feature, ?\Throwable $previous = null)
11
    {
12
        $message = sprintf('This function can only be used with feature flag %s inactive', $feature);
13
        parent::__construct($message, [], $previous);
14
    }
15
16
    public function getErrorCode(): string
17
    {
18
        return 'FEATURE_ACTIVE';
19
    }
20
21
    public function getStatusCode(): int
22
    {
23
        return Response::HTTP_BAD_REQUEST;
24
    }
25
}
26