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