Passed
Push — trunk ( 17375e...d9bd07 )
by Christian
12:35 queued 12s
created

ThemeException::salesChannelNotFound()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Storefront\Theme\Exception;
4
5
use Shopware\Core\Framework\HttpException;
6
use Shopware\Core\Framework\Log\Package;
7
use Symfony\Component\HttpFoundation\Response;
8
9
#[Package('storefront')]
10
class ThemeException extends HttpException
11
{
12
    public const THEME_MEDIA_IN_USE_EXCEPTION = 'THEME__MEDIA_IN_USE_EXCEPTION';
13
    public const THEME_SALES_CHANNEL_NOT_FOUND = 'THEME__SALES_CHANNEL_NOT_FOUND';
14
15
    public static function themeMediaStillInUse(): self
16
    {
17
        return new self(
18
            Response::HTTP_BAD_REQUEST,
19
            self::THEME_MEDIA_IN_USE_EXCEPTION,
20
            'Media entity is still in use by a theme'
21
        );
22
    }
23
24
    public static function salesChannelNotFound(string $salesChannelId): self
25
    {
26
        return new self(
27
            Response::HTTP_BAD_REQUEST,
28
            self::THEME_SALES_CHANNEL_NOT_FOUND,
29
            'The sales channel with the id {{ id }} could not be found',
30
            ['id' => $salesChannelId]
31
        );
32
    }
33
}
34