|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Jabe\Model\Knd\ConstructionSupervision\Impl\Instance\Request; |
|
4
|
|
|
|
|
5
|
|
|
use Jabe\Model\Xml\ModelBuilder; |
|
6
|
|
|
use Jabe\Model\Xml\Impl\Instance\ModelElementInstanceImpl; |
|
7
|
|
|
use Jabe\Model\Xml\Impl\Instance\ModelTypeInstanceContext; |
|
8
|
|
|
use Jabe\Model\Xml\Type\ModelTypeInstanceProviderInterface; |
|
9
|
|
|
use Jabe\Model\Knd\ConstructionSupervision\Impl\RequestModelConstants; |
|
10
|
|
|
use Jabe\Model\Knd\ConstructionSupervision\Instance\Request\{ |
|
11
|
|
|
CompetentOrganizationInterface, |
|
12
|
|
|
DataInterface, |
|
13
|
|
|
DelegateInfoInterface, |
|
14
|
|
|
GoalInterface, |
|
15
|
|
|
MethodGettingResultsInterface, |
|
16
|
|
|
RecipientPersonalDataInterface, |
|
17
|
|
|
RequestInterface, |
|
18
|
|
|
ServiceInterface |
|
19
|
|
|
}; |
|
20
|
|
|
|
|
21
|
|
|
class RequestImpl extends ModelElementInstanceImpl implements RequestInterface |
|
22
|
|
|
{ |
|
23
|
|
|
private static $competentOrganization; |
|
24
|
|
|
private static $data; |
|
25
|
|
|
private static $delegateInfo; |
|
26
|
|
|
private static $goal; |
|
27
|
|
|
private static $methodGettingResults; |
|
28
|
|
|
private static $recipientPersonalData; |
|
29
|
|
|
private static $service; |
|
30
|
|
|
|
|
31
|
|
|
public static function registerType(ModelBuilder $modelBuilder): void |
|
32
|
|
|
{ |
|
33
|
|
|
$typeBuilder = $modelBuilder->defineType( |
|
34
|
|
|
RequestInterface::class, |
|
35
|
|
|
RequestModelConstants::ELEMENT_NAME_REQUEST |
|
36
|
|
|
) |
|
37
|
|
|
->namespaceUri(RequestModelConstants::MODEL_NAMESPACE) |
|
38
|
|
|
->instanceProvider( |
|
39
|
|
|
new class implements ModelTypeInstanceProviderInterface |
|
40
|
|
|
{ |
|
41
|
|
|
public function newInstance(ModelTypeInstanceContext $instanceContext): RequestInterface |
|
42
|
|
|
{ |
|
43
|
|
|
return new RequestImpl($instanceContext); |
|
44
|
|
|
} |
|
45
|
|
|
} |
|
46
|
|
|
); |
|
47
|
|
|
|
|
48
|
|
|
$sequenceBuilder = $typeBuilder->sequence(); |
|
49
|
|
|
|
|
50
|
|
|
self::$competentOrganization = $sequenceBuilder->element(CompetentOrganizationInterface::class) |
|
51
|
|
|
->build(); |
|
52
|
|
|
self::$data = $sequenceBuilder->element(DataInterface::class) |
|
53
|
|
|
->build(); |
|
54
|
|
|
self::$delegateInfo = $sequenceBuilder->element(DelegateInfoInterface::class) |
|
55
|
|
|
->build(); |
|
56
|
|
|
self::$goal = $sequenceBuilder->element(GoalInterface::class) |
|
57
|
|
|
->build(); |
|
58
|
|
|
self::$methodGettingResults = $sequenceBuilder->element(MethodGettingResultsInterface::class) |
|
59
|
|
|
->build(); |
|
60
|
|
|
self::$recipientPersonalData = $sequenceBuilder->element(RecipientPersonalDataInterface::class) |
|
61
|
|
|
->build(); |
|
62
|
|
|
self::$service = $sequenceBuilder->element(ServiceInterface::class) |
|
63
|
|
|
->build(); |
|
64
|
|
|
|
|
65
|
|
|
$typeBuilder->build(); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function __construct(ModelTypeInstanceContext $instanceContext) |
|
69
|
|
|
{ |
|
70
|
|
|
parent::__construct($instanceContext); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function getCompetentOrganization(): CompetentOrganizationInterface |
|
74
|
|
|
{ |
|
75
|
|
|
return self::$competentOrganization->getChild($this); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
public function getData(): DataInterface |
|
79
|
|
|
{ |
|
80
|
|
|
return self::$data->getChild($this); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
public function getDelegateInfo(): DelegateInfoInterface |
|
84
|
|
|
{ |
|
85
|
|
|
return self::$delegateInfo->getChild($this); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
public function getGoal(): GoalInterface |
|
89
|
|
|
{ |
|
90
|
|
|
return self::$goal->getChild($this); |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
public function getMethodGettingResults(): MethodGettingResultsInterface |
|
94
|
|
|
{ |
|
95
|
|
|
return self::$methodGettingResults->getChild($this); |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
public function getRecipientPersonalData(): RecipientPersonalDataInterface |
|
99
|
|
|
{ |
|
100
|
|
|
return self::$recipientPersonalData->getChild($this); |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
public function getService(): ServiceInterface |
|
104
|
|
|
{ |
|
105
|
|
|
return self::$service->getChild($this); |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
public function asArray(): array |
|
109
|
|
|
{ |
|
110
|
|
|
return [ |
|
111
|
|
|
"Service" => self::$service->getChild($this)->asArray(), |
|
112
|
|
|
"Goal" => self::$goal->getChild($this)->getTextContent(), |
|
113
|
|
|
"DelegateInfo" => self::$delegateInfo->getChild($this)->getTextContent(), |
|
114
|
|
|
"RecipientPersonalData" => self::$recipientPersonalData->getChild($this)->asArray(), |
|
115
|
|
|
"CompetentOrganization" => self::$competentOrganization->getChild($this)->asArray(), |
|
116
|
|
|
"Data" => self::$data->getChild($this)->asArray(), |
|
117
|
|
|
"MethodGettingResults" => self::$methodGettingResults->getChild($this)->asArray() |
|
118
|
|
|
]; |
|
119
|
|
|
} |
|
120
|
|
|
} |
|
121
|
|
|
|