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 | public function getDefaults() |
| 12 | { |
| 13 | return [ |
| 14 | 'id' => '', |
| 15 | 'name' => '', |
| 16 | 'source' => 'dldb', |
| 17 | 'parent_id' => null, |
| 18 | 'variant_id' => null |
| 19 | ]; |
| 20 | } |
| 21 | |
| 22 | public function withReference($additionalData = []) |
| 23 | { |
| 24 | $additionalData['id'] = $this->getId(); |
| 25 | $additionalData['name'] = $this->getName(); |
| 26 | return parent::withReference($additionalData); |
| 27 | } |
| 28 | |
| 29 | public function hasAppointmentFromProviderData() |
| 30 | { |
| 31 | if (isset($this['data']) && isset($this['data']['locations'])) { |
| 32 | foreach ($this['data']['locations'] as $provider) { |
| 33 | if ( |
| 34 | (!isset($provider['appointment']['external']) || !$provider['appointment']['external']) |
| 35 | && isset($provider['appointment']['allowed']) && $provider['appointment']['allowed'] |
| 36 | ) { |
| 37 | return true; |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | return false; |
| 42 | } |
| 43 | |
| 44 | public function getSource() |
| 45 | { |
| 46 | return $this->toProperty()->source->get(); |
| 47 | } |
| 48 | |
| 49 | public function getGroup() |
| 50 | { |
| 51 | return $this->toProperty()->group->get(); |
| 52 | } |
| 53 | |
| 54 | public function getLink() |
| 55 | { |
| 56 | return $this->toProperty()->link->get(); |
| 57 | } |
| 58 | |
| 59 | public function getName() |
| 60 | { |
| 61 | return $this->toProperty()->name->get(); |
| 62 | } |
| 63 | |
| 64 | public function getAdditionalData() |
| 65 | { |
| 66 | return $this->toProperty()->data->get(); |
| 67 | } |
| 68 | |
| 69 | public function getParentId() |
| 70 | { |
| 71 | return $this->toProperty()->parent_id->get(); |
| 72 | } |
| 73 | |
| 74 | public function getVariantId() |
| 75 | { |
| 76 | return $this->toProperty()->variant_id->get(); |
| 77 | } |
| 78 | |
| 79 | public function __toString() |
| 80 | { |
| 81 | return $this->getName(); |
| 82 | } |
| 83 | } |