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

MD5ThemePathBuilder   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A saveSeed() 0 2 1
A assemblePath() 0 3 1
A getDecorated() 0 3 1
A generateNewPath() 0 3 1
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