Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
87.50% |
21 / 24 |
|
72.73% |
8 / 11 |
CRAP | |
0.00% |
0 / 1 |
| Request | |
87.50% |
21 / 24 |
|
72.73% |
8 / 11 |
18.63 | |
0.00% |
0 / 1 |
| getDefaults | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 | |||
| withReference | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| hasAppointmentFromProviderData | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
8 | |||
| getSource | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getGroup | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getLink | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getAdditionalData | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getParentId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getVariantId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| __toString | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace BO\Zmsentities; |
| 4 | |
| 5 | class Request extends Schema\Entity |
| 6 | { |
| 7 | public const PRIMARY = 'id'; |
| 8 | |
| 9 | public static $schema = "request.json"; |
| 10 | |
| 11 | #[\Override] |
| 12 | public function getDefaults() |
| 13 | { |
| 14 | return [ |
| 15 | 'id' => '', |
| 16 | 'name' => '', |
| 17 | 'source' => 'dldb', |
| 18 | 'parent_id' => null, |
| 19 | 'variant_id' => null |
| 20 | ]; |
| 21 | } |
| 22 | |
| 23 | #[\Override] |
| 24 | public function withReference($additionalData = []) |
| 25 | { |
| 26 | $additionalData['id'] = $this->getId(); |
| 27 | $additionalData['name'] = $this->getName(); |
| 28 | return parent::withReference($additionalData); |
| 29 | } |
| 30 | |
| 31 | public function hasAppointmentFromProviderData() |
| 32 | { |
| 33 | if (isset($this['data']) && isset($this['data']['locations'])) { |
| 34 | foreach ($this['data']['locations'] as $provider) { |
| 35 | if ( |
| 36 | (!isset($provider['appointment']['external']) || !$provider['appointment']['external']) |
| 37 | && isset($provider['appointment']['allowed']) && $provider['appointment']['allowed'] |
| 38 | ) { |
| 39 | return true; |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | return false; |
| 44 | } |
| 45 | |
| 46 | public function getSource() |
| 47 | { |
| 48 | return $this->toProperty()->source->get(); |
| 49 | } |
| 50 | |
| 51 | public function getGroup() |
| 52 | { |
| 53 | return $this->toProperty()->group->get(); |
| 54 | } |
| 55 | |
| 56 | public function getLink() |
| 57 | { |
| 58 | return $this->toProperty()->link->get(); |
| 59 | } |
| 60 | |
| 61 | public function getName() |
| 62 | { |
| 63 | return $this->toProperty()->name->get(); |
| 64 | } |
| 65 | |
| 66 | public function getAdditionalData() |
| 67 | { |
| 68 | return $this->toProperty()->data->get(); |
| 69 | } |
| 70 | |
| 71 | public function getParentId() |
| 72 | { |
| 73 | return $this->toProperty()->parent_id->get(); |
| 74 | } |
| 75 | |
| 76 | public function getVariantId() |
| 77 | { |
| 78 | return $this->toProperty()->variant_id->get(); |
| 79 | } |
| 80 | |
| 81 | public function __toString() |
| 82 | { |
| 83 | return $this->getName(); |
| 84 | } |
| 85 | } |