Passed
Push — trunk ( f797a9...e92141 )
by Christian
22:24 queued 10:00
created

MD5ThemePathBuilder::generateNewPath()   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 3
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Storefront\Theme;
4
5
use Shopware\Core\Framework\Plugin\Exception\DecorationPatternException;
6
7
/**
8
 * @package storefront
9
 *
10
 * ThemePathBuilder that does not support seeding,
11
 * this should only be used in projects where recompiling the theme at runtime is not supported (e.g. PaaS) or for testing.
12
 */
13
class MD5ThemePathBuilder extends AbstractThemePathBuilder
14
{
15
    public function assemblePath(string $salesChannelId, string $themeId): string
16
    {
17
        return md5($themeId . $salesChannelId);
18
    }
19
20
    public function generateNewPath(string $salesChannelId, string $themeId, string $seed): string
21
    {
22
        return $this->assemblePath($salesChannelId, $themeId);
23
    }
24
25
    public function saveSeed(string $salesChannelId, string $themeId, string $seed): void
26
    {
27
        // do nothing, as this implementation does not support seeding
28
    }
29
30
    public function getDecorated(): AbstractThemePathBuilder
31
    {
32
        throw new DecorationPatternException(self::class);
33
    }
34
}
35