1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* The MIT License |
5
|
|
|
* |
6
|
|
|
* Copyright 2016 Julien Fastré <[email protected]>. |
7
|
|
|
* |
8
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
9
|
|
|
* of this software and associated documentation files (the "Software"), to deal |
10
|
|
|
* in the Software without restriction, including without limitation the rights |
11
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
12
|
|
|
* copies of the Software, and to permit persons to whom the Software is |
13
|
|
|
* furnished to do so, subject to the following conditions: |
14
|
|
|
* |
15
|
|
|
* The above copyright notice and this permission notice shall be included in |
16
|
|
|
* all copies or substantial portions of the Software. |
17
|
|
|
* |
18
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
19
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
20
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
21
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
22
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
23
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
24
|
|
|
* THE SOFTWARE. |
25
|
|
|
*/ |
26
|
|
|
|
27
|
|
|
namespace PHPHealth\CDA\RIM\Entity; |
28
|
|
|
|
29
|
|
|
use PHPHealth\CDA\ElementInterface; |
30
|
|
|
use PHPHealth\CDA\ClinicalDocument as CDA; |
31
|
|
|
use PHPHealth\CDA\DataType\Quantity\DateAndTime\TimeStamp; |
32
|
|
|
use PHPHealth\CDA\DataType\Collection\Set; |
33
|
|
|
use PHPHealth\CDA\Elements\AdministrativeGenderCode; |
34
|
|
|
use PHPHealth\CDA\DataType\Code\CodedValue; |
35
|
|
|
use PHPHealth\CDA\Elements\BirthTime; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* |
39
|
|
|
* |
40
|
|
|
* @author Julien Fastré <[email protected]> |
41
|
|
|
*/ |
42
|
|
|
abstract class Person extends LivingSubject |
43
|
|
|
{ |
44
|
|
|
public function __construct( |
45
|
|
|
Set $names = null, |
46
|
|
|
TimeStamp $birthtime = null, |
47
|
|
|
CodedValue $administrativeGenderCode = null |
48
|
|
|
) { |
49
|
|
|
if ($names !== null) { |
50
|
|
|
$this->setNames($names); |
51
|
|
|
} |
52
|
|
|
if ($birthtime !== null) { |
53
|
|
|
$this->setBirthtime($birthtime); |
54
|
|
|
} |
55
|
|
|
if ($administrativeGenderCode !== null) { |
56
|
|
|
$this->setAdministrativeGenderCode($administrativeGenderCode); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function getDefaultClassCode() |
61
|
|
|
{ |
62
|
|
|
return 'PSN'; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
|
66
|
|
|
public function toDOMElement(\DOMDocument $doc) |
67
|
|
|
{ |
68
|
|
|
$el = parent::createElement($doc); |
|
|
|
|
69
|
|
|
//add names |
70
|
|
|
if ($this->getNames() !== null) { |
71
|
|
|
$this->getNames()->setValueToElement($el, $doc); |
72
|
|
|
} |
73
|
|
|
// add administrative gender code |
74
|
|
|
if ($this->getAdministrativeGenderCode() !== null) { |
75
|
|
|
$adm = new AdministrativeGenderCode($this->administrativeGenderCode); |
76
|
|
|
$el->appendChild($adm->toDOMElement($doc)); |
77
|
|
|
} |
78
|
|
|
// add birthtime |
79
|
|
|
if ($this->getBirthtime() !== null) { |
80
|
|
|
$bir = new BirthTime($this->birthtime); |
81
|
|
|
$el->appendChild($bir->toDOMElement($doc)); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
return $el; |
|
|
|
|
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.