Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
95.00% |
19 / 20 |
|
88.89% |
8 / 9 |
CRAP | |
0.00% |
0 / 1 |
Request | |
95.00% |
19 / 20 |
|
88.89% |
8 / 9 |
16 | |
0.00% |
0 / 1 |
getDefaults | |
100.00% |
5 / 5 |
|
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 | |||
__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 | ]; |
18 | } |
19 | |
20 | public function withReference($additionalData = []) |
21 | { |
22 | $additionalData['id'] = $this->getId(); |
23 | $additionalData['name'] = $this->getName(); |
24 | return parent::withReference($additionalData); |
25 | } |
26 | |
27 | public function hasAppointmentFromProviderData() |
28 | { |
29 | if (isset($this['data']) && isset($this['data']['locations'])) { |
30 | foreach ($this['data']['locations'] as $provider) { |
31 | if ( |
32 | (!isset($provider['appointment']['external']) || !$provider['appointment']['external']) |
33 | && isset($provider['appointment']['allowed']) && $provider['appointment']['allowed'] |
34 | ) { |
35 | return true; |
36 | } |
37 | } |
38 | } |
39 | return false; |
40 | } |
41 | |
42 | public function getSource() |
43 | { |
44 | return $this->toProperty()->source->get(); |
45 | } |
46 | |
47 | public function getGroup() |
48 | { |
49 | return $this->toProperty()->group->get(); |
50 | } |
51 | |
52 | public function getLink() |
53 | { |
54 | return $this->toProperty()->link->get(); |
55 | } |
56 | |
57 | public function getName() |
58 | { |
59 | return $this->toProperty()->name->get(); |
60 | } |
61 | |
62 | public function getAdditionalData() |
63 | { |
64 | return $this->toProperty()->data->get(); |
65 | } |
66 | |
67 | public function __toString() |
68 | { |
69 | return $this->getName(); |
70 | } |
71 | } |