| Total Complexity | 7 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 11 | class SeedingThemePathBuilder extends AbstractThemePathBuilder |
||
| 12 | { |
||
| 13 | private const SYSTEM_CONFIG_KEY = 'storefront.themeSeed'; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @internal |
||
| 17 | */ |
||
| 18 | public function __construct( |
||
| 21 | } |
||
| 22 | |||
| 23 | public function assemblePath(string $salesChannelId, string $themeId): string |
||
| 24 | { |
||
| 25 | return $this->generateNewPath($salesChannelId, $themeId, $this->getSeed($salesChannelId)); |
||
| 26 | } |
||
| 27 | |||
| 28 | public function generateNewPath(string $salesChannelId, string $themeId, string $seed): string |
||
| 29 | { |
||
| 30 | return md5($themeId . $salesChannelId . $seed); |
||
| 31 | } |
||
| 32 | |||
| 33 | public function saveSeed(string $salesChannelId, string $themeId, string $seed): void |
||
| 34 | { |
||
| 35 | $this->systemConfigService->set(self::SYSTEM_CONFIG_KEY, $seed, $salesChannelId); |
||
| 36 | } |
||
| 37 | |||
| 38 | public function getDecorated(): AbstractThemePathBuilder |
||
| 39 | { |
||
| 40 | throw new DecorationPatternException(self::class); |
||
| 41 | } |
||
| 42 | |||
| 43 | private function getSeed(string $salesChannelId): string |
||
| 53 | } |
||
| 54 | } |
||
| 55 |