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