Total Complexity | 6 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
12 | #[Package('system-settings')] |
||
13 | class AdminElasticsearchHelper |
||
14 | { |
||
15 | private bool $adminEsEnabled; |
||
16 | |||
17 | private bool $refreshIndices; |
||
18 | |||
19 | private string $adminIndexPrefix; |
||
20 | |||
21 | public function __construct(bool $adminEsEnabled, bool $refreshIndices, string $adminIndexPrefix) |
||
22 | { |
||
23 | $this->adminEsEnabled = $adminEsEnabled; |
||
24 | $this->refreshIndices = $refreshIndices; |
||
25 | $this->adminIndexPrefix = $adminIndexPrefix; |
||
26 | } |
||
27 | |||
28 | public function getEnabled(): bool |
||
29 | { |
||
30 | return $this->adminEsEnabled; |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * Only used for unit tests because the container parameter bag is frozen and can not be changed at runtime. |
||
35 | * Therefore this function can be used to test different behaviours |
||
36 | * |
||
37 | * @internal |
||
38 | */ |
||
39 | public function setEnabled(bool $enabled): self |
||
40 | { |
||
41 | $this->adminEsEnabled = $enabled; |
||
42 | |||
43 | return $this; |
||
44 | } |
||
45 | |||
46 | public function getRefreshIndices(): bool |
||
47 | { |
||
48 | return $this->refreshIndices; |
||
49 | } |
||
50 | |||
51 | public function getPrefix(): string |
||
52 | { |
||
53 | return $this->adminIndexPrefix; |
||
54 | } |
||
55 | |||
56 | public function getIndex(string $name): string |
||
59 | } |
||
60 | } |
||
61 |