Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
84.62% |
22 / 26 |
|
80.00% |
4 / 5 |
CRAP | |
0.00% |
0 / 1 |
| Config | |
84.62% |
22 / 26 |
|
80.00% |
4 / 5 |
9.29 | |
0.00% |
0 / 1 |
| getDefaults | |
100.00% |
19 / 19 |
|
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 | public function getDefaults() |
| 10 | { |
| 11 | return [ |
| 12 | 'appointments' => [ |
| 13 | 'urlChange' => 'https://service.berlin.de/terminvereinbarung/termin/manage/', |
| 14 | 'urlAppointments' => 'https://service.berlin.de/terminvereinbarung/', |
| 15 | ], |
| 16 | 'ticketprinter' => [ |
| 17 | 'baseUrl' => '/terminvereinbarung/ticketprinter/' |
| 18 | ], |
| 19 | 'calldisplay' => [ |
| 20 | 'baseUrl' => '/terminvereinbarung/calldisplay/' |
| 21 | ], |
| 22 | 'emergency' => [ |
| 23 | 'refreshInterval' => 5 |
| 24 | ], |
| 25 | 'support' => [ |
| 26 | 'eMail' => 'hotline@itdz-berlin.de', |
| 27 | 'telephone' => '(030) 9222-2000' |
| 28 | ] |
| 29 | ]; |
| 30 | } |
| 31 | |
| 32 | public function hasType($type) |
| 33 | { |
| 34 | return (isset($this[$type])) ? true : false; |
| 35 | } |
| 36 | |
| 37 | public function hasPreference($type, $key) |
| 38 | { |
| 39 | return ($this->hasType($type) && isset($this[$type][$key])) ? true : false; |
| 40 | } |
| 41 | |
| 42 | public function getPreference($type, $key) |
| 43 | { |
| 44 | return $this->toProperty()->$type->$key->get(); |
| 45 | } |
| 46 | |
| 47 | public function setPreference($type, $key, $value) |
| 48 | { |
| 49 | $preference = $this->toProperty()->$type->$key->get(); |
| 50 | if (null !== $preference) { |
| 51 | $this[$type][$key] = $value; |
| 52 | } |
| 53 | return $this; |
| 54 | } |
| 55 | } |