Lines
86.20%
25 / 29
Functions and Methods
80.00%
4 / 5
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Config | 86.20% | 25 / 29 | 80.00% | 4 / 5 | 9.21 | 0.00% | 0 / 1 | |||
| getDefaults | 100.00% | 22 / 22 | 100.00% | 1 / 1 | 1 | |||||
| hasType | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 2 | |||||
| hasPreference | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 3 | |||||
| getPreference | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| setPreference | 0.00% | 0 / 4 | 0.00% | 0 / 1 | 6 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | namespace BO\Zmsentities; | |
| 4 | ||
| 5 | class Config extends Schema\Entity | |
| 6 | { | |
| 7 | public static $schema = "config.json"; | |
| 8 | ||
| 9 | /** | |
| 10 | * @return (int|string)[][] | |
| 11 | * | |
| 12 | */ | |
| 13 | #[\Override] | |
| 14 | public function getDefaults() | |
| 15 | { | |
| 16 | return [ | |
| 17 | 'appointments' => [ | |
| 18 | 'urlChange' => 'https://service.berlin.de/terminvereinbarung/termin/manage/', | |
| 19 | 'urlAppointments' => 'https://service.berlin.de/terminvereinbarung/', | |
| 20 | ], | |
| 21 | 'changelog' => [ | |
| 22 | 'urlReleaseNotes' => 'https://it-at-m.github.io/eappointment/overview/changelog.html' | |
| 23 | ], | |
| 24 | 'ticketprinter' => [ | |
| 25 | 'baseUrl' => '/terminvereinbarung/ticketprinter/' | |
| 26 | ], | |
| 27 | 'calldisplay' => [ | |
| 28 | 'baseUrl' => '/terminvereinbarung/calldisplay/' | |
| 29 | ], | |
| 30 | 'emergency' => [ | |
| 31 | 'refreshInterval' => 5 | |
| 32 | ], | |
| 33 | 'support' => [ | |
| 34 | 'eMail' => 'hotline@itdz-berlin.de', | |
| 35 | 'telephone' => '(030) 9222-2000' | |
| 36 | ] | |
| 37 | ]; | |
| 38 | } | |
| 39 | ||
| 40 | public function hasType(mixed $type): bool | |
| 41 | { | |
| 42 | return (isset($this[$type])) ? true : false; | |
| 43 | } | |
| 44 | ||
| 45 | public function hasPreference(mixed $type, mixed $key): bool | |
| 46 | { | |
| 47 | return ($this->hasType($type) && isset($this[$type][$key])) ? true : false; | |
| 48 | } | |
| 49 | ||
| 50 | public function getPreference(mixed $type, mixed $key): mixed | |
| 51 | { | |
| 52 | return $this->toProperty()->$type->$key->get(); | |
| 53 | } | |
| 54 | ||
| 55 | public function setPreference(mixed $type, mixed $key, mixed $value): static | |
| 56 | { | |
| 57 | $preference = $this->toProperty()->$type->$key->get(); | |
| 58 | if (null !== $preference) { | |
| 59 | $this[$type][$key] = $value; | |
| 60 | } | |
| 61 | return $this; | |
| 62 | } | |
| 63 | } |