1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
|
4
|
|
|
/** |
5
|
|
|
* The MIT License |
6
|
|
|
* |
7
|
|
|
* Copyright 2018 Peter Gee <https://github.com/pgee70>. |
8
|
|
|
* |
9
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
10
|
|
|
* of this software and associated documentation files (the "Software"), to deal |
11
|
|
|
* in the Software without restriction, including without limitation the rights |
12
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
13
|
|
|
* copies of the Software, and to permit persons to whom the Software is |
14
|
|
|
* furnished to do so, subject to the following conditions: |
15
|
|
|
* |
16
|
|
|
* The above copyright notice and this permission notice shall be included in |
17
|
|
|
* all copies or substantial portions of the Software. |
18
|
|
|
* |
19
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
20
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
21
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE |
22
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
23
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
24
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
25
|
|
|
* THE SOFTWARE. |
26
|
|
|
*/ |
27
|
|
|
|
28
|
|
|
namespace i3Soft\CDA\RIM\Entity; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* |
32
|
|
|
* @package i3Soft\CDA |
33
|
|
|
* @author Peter Gee <https://github.com/pgee70> |
34
|
|
|
* @link https://github.com/pgee70/cda |
35
|
|
|
* |
36
|
|
|
*/ |
37
|
|
|
|
38
|
|
|
use i3Soft\CDA\DataType\Collection\Set; |
39
|
|
|
use i3Soft\CDA\Interfaces\ClassCodeInterface; |
40
|
|
|
use i3Soft\CDA\RIM\Extensions\AsEmployment; |
41
|
|
|
use i3Soft\CDA\RIM\Extensions\AsQualifications; |
42
|
|
|
|
43
|
|
|
class AssignedPerson extends Person |
44
|
|
|
{ |
45
|
|
|
|
46
|
|
|
/** @var Set */ |
47
|
|
|
protected $person_name; |
48
|
|
|
|
49
|
|
|
/** @var AsEmployment */ |
50
|
|
|
protected $as_employment; |
51
|
|
|
|
52
|
|
|
/** @var AsQualifications */ |
53
|
|
|
protected $as_qualifications; |
54
|
|
|
|
55
|
|
|
/** @noinspection PhpMissingParentConstructorInspection */ |
56
|
|
|
/** @noinspection MagicMethodsValidityInspection */ |
57
|
|
|
public function __construct ($names = NULL, $as_entity_identifier = NULL, $as_employment = NULL, $as_qualifications = NULL) |
58
|
|
|
{ |
59
|
|
|
$this->setAcceptableClassCodes(ClassCodeInterface::EntityClass) |
60
|
|
|
->setClassCode(ClassCodeInterface::PERSON); |
61
|
|
|
if ($names) |
62
|
|
|
{ |
63
|
|
|
$this->setNames($names); |
64
|
|
|
} |
65
|
|
|
if ($as_entity_identifier) |
66
|
|
|
{ |
67
|
|
|
$this->setAsEntityIdentifier($as_entity_identifier); |
68
|
|
|
} |
69
|
|
|
if ($as_employment) |
70
|
|
|
{ |
71
|
|
|
$this->setAsEmployment($as_employment); |
72
|
|
|
} |
73
|
|
|
if ($as_qualifications) |
74
|
|
|
{ |
75
|
|
|
$this->setAsQualifications($as_qualifications); |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
public function toDOMElement (\DOMDocument $doc): \DOMElement |
80
|
|
|
{ |
81
|
|
|
$el = parent::toDOMElement($doc); |
82
|
|
|
if ($this->hasAsEmployment()) |
83
|
|
|
{ |
84
|
|
|
$el->appendChild($this->getAsEmployment()->toDOMElement($doc)); |
85
|
|
|
} |
86
|
|
|
if ($this->hasAsQualifications()) |
87
|
|
|
{ |
88
|
|
|
$el->appendChild($this->getAsQualifications()->toDOMElement($doc)); |
89
|
|
|
} |
90
|
|
|
return $el; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
public function hasAsEmployment (): bool |
94
|
|
|
{ |
95
|
|
|
return NULL !== $this->as_employment; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
public function getAsEmployment (): AsEmployment |
99
|
|
|
{ |
100
|
|
|
return $this->as_employment; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
public function setAsEmployment (AsEmployment $as_employment): self |
104
|
|
|
{ |
105
|
|
|
$this->as_employment = $as_employment; |
106
|
|
|
return $this; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
public function hasAsQualifications (): bool |
110
|
|
|
{ |
111
|
|
|
return NULL !== $this->as_qualifications; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
public function getAsQualifications (): AsQualifications |
115
|
|
|
{ |
116
|
|
|
return $this->as_qualifications; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
public function setAsQualifications (AsQualifications $as_qualifications): self |
120
|
|
|
{ |
121
|
|
|
$this->as_qualifications = $as_qualifications; |
122
|
|
|
return $this; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
protected function getElementTag (): string |
126
|
|
|
{ |
127
|
|
|
return 'assignedPerson'; |
128
|
|
|
} |
129
|
|
|
} |