alex-kalanis /
pohoda
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Riesenia\Pohoda\PrintRequest; |
||
| 4 | |||
| 5 | class ParameterInstances |
||
| 6 | { |
||
| 7 | /** @var array<string, class-string<Parameter>> */ |
||
|
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||
| 8 | protected array $instances = [ |
||
| 9 | 'checkbox1' => Checkbox1::class, |
||
| 10 | 'checkbox2' => Checkbox2::class, |
||
| 11 | 'checkbox3' => Checkbox3::class, |
||
| 12 | 'checkbox4' => Checkbox4::class, |
||
| 13 | 'checkbox5' => Checkbox5::class, |
||
| 14 | 'checkbox6' => Checkbox6::class, |
||
| 15 | 'checkbox7' => Checkbox7::class, |
||
| 16 | 'checkbox8' => Checkbox8::class, |
||
| 17 | 'radioButton1' => RadioButton1::class, |
||
| 18 | 'spin1' => Spin1::class, |
||
| 19 | 'currency1' => Currency1::class, |
||
| 20 | 'month1' => Month1::class, |
||
| 21 | 'month2' => Month2::class, |
||
| 22 | 'year1' => Year1::class, |
||
| 23 | 'date1' => Date1::class, |
||
| 24 | 'date2' => Date2::class, |
||
| 25 | 'date3' => Date3::class, |
||
| 26 | 'date4' => Date4::class, |
||
| 27 | 'text1' => Text1::class, |
||
| 28 | 'text2' => Text2::class, |
||
| 29 | 'text3' => Text3::class, |
||
| 30 | 'combobox1' => Combobox1::class, |
||
| 31 | 'combobox2' => Combobox2::class, |
||
| 32 | 'combobox3' => Combobox3::class, |
||
| 33 | 'comboboxEx1' => ComboboxEx1::class, |
||
| 34 | 'comboboxEx2' => ComboboxEx2::class, |
||
| 35 | ]; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @param string $key |
||
| 39 | * @return class-string<Parameter> |
||
|
0 ignored issues
–
show
|
|||
| 40 | */ |
||
| 41 | 7 | public function getByKey(string $key): string |
|
| 42 | { |
||
| 43 | 7 | if (!isset($this->instances[$key])) { |
|
| 44 | 1 | throw new \DomainException(sprintf('The key *%s* is not known.', $key)); |
|
| 45 | } |
||
| 46 | 6 | return $this->instances[$key]; |
|
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @return string[] |
||
| 51 | */ |
||
| 52 | 3 | public function getKeys(): array |
|
| 53 | { |
||
| 54 | 3 | return array_keys($this->instances); |
|
| 55 | } |
||
| 56 | } |
||
| 57 |