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 | |||
39 | use i3Soft\CDA\DataType\Name\EntityName; |
||
40 | use i3Soft\CDA\Elements\AbstractElement; |
||
41 | use i3Soft\CDA\Elements\Address\Addr; |
||
42 | use i3Soft\CDA\Elements\Address\Telecom; |
||
43 | use i3Soft\CDA\RIM\Extensions\AsEntityIdentifier; |
||
44 | use i3Soft\CDA\Traits\AddrsTrait; |
||
45 | use i3Soft\CDA\Traits\AsEntityIdentifierTrait; |
||
46 | use i3Soft\CDA\Traits\EntityNameTrait; |
||
47 | use i3Soft\CDA\Traits\TelecomsTrait; |
||
48 | |||
49 | |||
50 | /** |
||
51 | * Class WholeOrganisation |
||
52 | * |
||
53 | * @package i3Soft\CDA\RIM\Extensions |
||
54 | */ |
||
55 | class WholeOrganisation extends AbstractElement |
||
56 | { |
||
57 | use EntityNameTrait; |
||
58 | use AsEntityIdentifierTrait; |
||
59 | use AddrsTrait; |
||
60 | use TelecomsTrait; |
||
61 | |||
62 | /** |
||
63 | * WholeOrganisation constructor. |
||
64 | * |
||
65 | * @param null $name |
||
0 ignored issues
–
show
Documentation
Bug
introduced
by
![]() |
|||
66 | * @param null $as_identifier |
||
0 ignored issues
–
show
|
|||
67 | * @param null $addr |
||
0 ignored issues
–
show
|
|||
68 | * @param null $telecom |
||
0 ignored issues
–
show
|
|||
69 | */ |
||
70 | public function __construct ($name = NULL, $as_identifier = NULL, $addr = NULL, $telecom = NULL) |
||
71 | { |
||
72 | if ($name && $name instanceof EntityName) |
||
0 ignored issues
–
show
|
|||
73 | { |
||
74 | $this->setName($name); |
||
75 | } |
||
76 | if ($as_identifier && $as_identifier instanceof AsEntityIdentifier) |
||
0 ignored issues
–
show
|
|||
77 | { |
||
78 | $this->setAsEntityIdentifier($as_identifier); |
||
79 | } |
||
80 | if ($addr && $addr instanceof Addr) |
||
0 ignored issues
–
show
|
|||
81 | { |
||
82 | $this->addAddr($addr); |
||
83 | } |
||
84 | if ($telecom && $telecom instanceof Telecom) |
||
0 ignored issues
–
show
|
|||
85 | { |
||
86 | $this->addTelecom($telecom); |
||
87 | } |
||
88 | } |
||
89 | |||
90 | /** |
||
91 | * @param \DOMDocument $doc |
||
92 | * |
||
93 | * @return \DOMElement |
||
94 | */ |
||
95 | public function toDOMElement (\DOMDocument $doc): \DOMElement |
||
96 | { |
||
97 | $el = $this->createElement($doc); |
||
98 | $this->renderEntityName($el, $doc); |
||
99 | $this->renderAsEntityIdentifier($el, $doc); |
||
100 | $this->renderAddrs($el, $doc); |
||
101 | $this->renderTelecoms($el, $doc); |
||
102 | return $el; |
||
103 | } |
||
104 | |||
105 | |||
106 | /** |
||
107 | * @return string |
||
108 | */ |
||
109 | protected function getElementTag (): string |
||
110 | { |
||
111 | return 'wholeOrganization'; |
||
112 | } |
||
113 | |||
114 | } |