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\Traits; |
29
|
|
|
|
30
|
|
|
|
31
|
|
|
use i3Soft\CDA\DataType\Code\CodedValue; |
32
|
|
|
use i3Soft\CDA\Elements\AdministrativeGenderCode; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Trait AdministrativeGenderCodeTrait |
36
|
|
|
* |
37
|
|
|
* @package i3Soft\CDA\Traits |
38
|
|
|
*/ |
39
|
|
|
trait AdministrativeGenderCodeTrait |
40
|
|
|
{ |
41
|
|
|
/** @var AdministrativeGenderCode */ |
42
|
|
|
private $administrative_gender_code; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @param \DOMElement $el |
46
|
|
|
* @param \DOMDocument $doc |
47
|
|
|
* |
48
|
|
|
* @return AdministrativeGenderCodeTrait |
49
|
|
|
*/ |
50
|
|
|
public function renderAdministrativeGenderCode (\DOMElement $el, \DOMDocument $doc): self |
51
|
|
|
{ |
52
|
|
|
if ($this->hasAdministrativeGenderCode()) |
53
|
|
|
{ |
54
|
|
|
$el->appendChild($this->getAdministrativeGenderCode()->toDOMElement($doc)); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
return $this; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return bool |
62
|
|
|
*/ |
63
|
|
|
public function hasAdministrativeGenderCode (): bool |
64
|
|
|
{ |
65
|
|
|
return NULL !== $this->administrative_gender_code; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @return AdministrativeGenderCode |
70
|
|
|
*/ |
71
|
|
|
public function getAdministrativeGenderCode (): AdministrativeGenderCode |
72
|
|
|
{ |
73
|
|
|
return $this->administrative_gender_code; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @param $value |
78
|
|
|
* |
79
|
|
|
* @return self |
80
|
|
|
*/ |
81
|
|
|
public function setAdministrativeGenderCode ($value): self |
82
|
|
|
{ |
83
|
|
|
if ($value instanceof CodedValue) |
84
|
|
|
{ |
85
|
|
|
$this->administrative_gender_code = new AdministrativeGenderCode($value); |
86
|
|
|
return $this; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
if ($value instanceof AdministrativeGenderCode) |
90
|
|
|
{ |
91
|
|
|
$this->administrative_gender_code = $value; |
92
|
|
|
return $this; |
93
|
|
|
} |
94
|
|
|
$this->administrative_gender_code = AdministrativeGenderCode::getCodedValueFromString($value); |
|
|
|
|
95
|
|
|
return $this; |
96
|
|
|
} |
97
|
|
|
} |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..