Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 16 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| ConfigKeyStruct | |
0.00% |
0 / 16 |
|
0.00% |
0 / 5 |
90 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
30 | |||
| getOriginalKey | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getAnlass | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getDataIdentifier | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getParts | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php declare(strict_types=1); |
| 2 | |
| 3 | namespace Satag\AmicronEntityBundle\Util\PlattformKonfig; |
| 4 | |
| 5 | class ConfigKeyStruct |
| 6 | { |
| 7 | private readonly string $anlass; |
| 8 | |
| 9 | private readonly string $dataIdentifier; |
| 10 | |
| 11 | /** |
| 12 | * @var string[] |
| 13 | */ |
| 14 | private array $parts; |
| 15 | |
| 16 | public function __construct( |
| 17 | private readonly string $originalKey |
| 18 | ) { |
| 19 | $parts = explode('.', $originalKey); |
| 20 | if (\count($parts) < 2) { |
| 21 | throw new ConfigKeyStructException(\sprintf("Ungültiger Schlüssel (%s) min. 2 Stufen\r\n", $originalKey)); |
| 22 | } |
| 23 | $this->anlass = trim($parts[0]); |
| 24 | if ($this->anlass === '') { |
| 25 | throw new ConfigKeyStructException(\sprintf("Ungültiger Schlüssel (%s) min. 2 Stufen\r\n", $originalKey)); |
| 26 | } |
| 27 | $this->dataIdentifier = trim($parts[1]); |
| 28 | if ($this->dataIdentifier === '') { |
| 29 | throw new ConfigKeyStructException(\sprintf("Ungültiger Schlüssel (%s) min. 2 Stufen\r\n", $originalKey)); |
| 30 | } |
| 31 | if (\count($parts) === 2) { |
| 32 | $this->parts = []; |
| 33 | } else { |
| 34 | $this->parts = array_splice($parts, 2); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | public function getOriginalKey(): string |
| 39 | { |
| 40 | return $this->originalKey; |
| 41 | } |
| 42 | |
| 43 | public function getAnlass(): string |
| 44 | { |
| 45 | return $this->anlass; |
| 46 | } |
| 47 | |
| 48 | public function getDataIdentifier(): string |
| 49 | { |
| 50 | return $this->dataIdentifier; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * @return string[] |
| 55 | */ |
| 56 | public function getParts(): array |
| 57 | { |
| 58 | return $this->parts; |
| 59 | } |
| 60 | } |