Total Complexity | 9 |
Total Lines | 56 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
14 | class CodeBucketConfig extends AbstractCodeBucketConfig |
||
15 | { |
||
16 | /** |
||
17 | * @return array<string> |
||
18 | */ |
||
19 | public function getCodeBuckets(): array |
||
20 | { |
||
21 | if ($this->isAcpDevOn()) { |
||
22 | return Store::getInstance()->getAllowedStores(); |
||
23 | } |
||
24 | |||
25 | return [ |
||
26 | 'EU', |
||
27 | 'US', |
||
28 | 'DE', |
||
29 | 'AT', |
||
30 | ]; |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @deprecated This method implementation will be removed when environment configs are cleaned up. |
||
35 | * |
||
36 | * @return string |
||
37 | */ |
||
38 | public function getDefaultCodeBucket(): string |
||
39 | { |
||
40 | if ($this->isAcpDevOn()) { |
||
41 | return APPLICATION_STORE; |
||
42 | } |
||
43 | |||
44 | $codeBuckets = $this->getCodeBuckets(); |
||
45 | |||
46 | $parts = explode('/', $this->getPathInfo()); |
||
47 | if (isset($parts[1]) && in_array($parts[1], $codeBuckets, true)) { |
||
48 | return $parts[1]; |
||
49 | } |
||
50 | |||
51 | return defined('APPLICATION_REGION') ? APPLICATION_REGION : reset($codeBuckets); |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * @return bool |
||
56 | */ |
||
57 | protected function isAcpDevOn(): bool |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * @return string |
||
64 | */ |
||
65 | protected function getPathInfo(): string |
||
70 | } |
||
71 | } |
||
72 |