Procedure   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 49
dl 0
loc 79
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A toDOMElement() 0 23 1
A getElementTag() 0 3 1
1
<?php
2
3
/**
4
 * The MIT License
5
 *
6
 * Copyright 2018  Peter Gee <https://github.com/pgee70>.
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 NON INFRINGEMENT. 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
/**
28
 *
29
 * @package     i3Soft\CDA
30
 * @author      Peter Gee <https://github.com/pgee70>
31
 * @link        https://github.com/pgee70/cda
32
 *
33
 */
34
35
36
namespace i3Soft\CDA\Elements;
37
38
39
use i3Soft\CDA\Interfaces\ClassCodeInterface;
40
use i3Soft\CDA\Interfaces\MoodCodeInterface;
41
use i3Soft\CDA\Interfaces\NegationInterface;
42
use i3Soft\CDA\Traits\ApproachSiteCodesTrait;
43
use i3Soft\CDA\Traits\AuthorsTrait;
44
use i3Soft\CDA\Traits\ClassCodeTrait;
45
use i3Soft\CDA\Traits\CodeTrait;
46
use i3Soft\CDA\Traits\EffectiveTimeTrait;
47
use i3Soft\CDA\Traits\EntryRelationshipsTrait;
48
use i3Soft\CDA\Traits\IdsTrait;
49
use i3Soft\CDA\Traits\InformantsTrait;
50
use i3Soft\CDA\Traits\LanguageCodeTrait;
51
use i3Soft\CDA\Traits\MethodCodesTrait;
52
use i3Soft\CDA\Traits\MoodCodeTrait;
53
use i3Soft\CDA\Traits\NegationIndTrait;
54
use i3Soft\CDA\Traits\ParticipantsTrait;
55
use i3Soft\CDA\Traits\PerformersTrait;
56
use i3Soft\CDA\Traits\PreconditionsTrait;
57
use i3Soft\CDA\Traits\PriorityCodeTrait;
58
use i3Soft\CDA\Traits\ReferencesTrait;
59
use i3Soft\CDA\Traits\SpecimensTrait;
60
use i3Soft\CDA\Traits\StatusCodeTrait;
61
use i3Soft\CDA\Traits\SubjectTrait;
62
use i3Soft\CDA\Traits\TargetSiteCodesTrait;
63
use i3Soft\CDA\Traits\TextTrait;
64
65
class Procedure extends AbstractElement implements ClassCodeInterface, MoodCodeInterface, NegationInterface
66
{
67
  use IdsTrait;
68
  use CodeTrait;
69
  use TextTrait;
70
  use StatusCodeTrait;
71
  use EffectiveTimeTrait;
72
  use PriorityCodeTrait;
73
  use LanguageCodeTrait;
74
  use MethodCodesTrait;
75
  use ApproachSiteCodesTrait;
76
  use TargetSiteCodesTrait;
77
  use SubjectTrait;
78
  use SpecimensTrait;
79
  use PerformersTrait;
80
  use AuthorsTrait;
81
  use InformantsTrait;
82
  use ParticipantsTrait;
83
  use EntryRelationshipsTrait;
84
  use ReferencesTrait;
85
  use PreconditionsTrait;
86
87
  use MoodCodeTrait;
88
  use ClassCodeTrait;
89
  use NegationIndTrait;
90
91
  /**
92
   * Procedure constructor.
93
   */
94
  public function __construct ()
95
  {
96
    $this->setAcceptableClassCodes(ClassCodeInterface::ActClass)
97
      ->setClassCode(ClassCodeInterface::PROCEDURE)
98
      ->setAcceptableMoodCodes(MoodCodeInterface::x_DocumentProcedureMood)
99
      ->setMoodCode(MoodCodeInterface::EVENT);
100
  }
101
102
  /**
103
   * Transforms the element into a DOMElement, which will be included
104
   * into the final CDA XML
105
   *
106
   * @param \DOMDocument $doc
107
   *
108
   * @return \DOMElement
109
   */
110
  public function toDOMElement (\DOMDocument $doc): \DOMElement
111
  {
112
    $el = $this->createElement($doc);
113
    $this->renderIds($el, $doc)
114
      ->renderCode($el, $doc)
115
      ->renderText($el, $doc)
116
      ->renderStatusCode($el, $doc)
117
      ->renderEffectiveTime($el, $doc)
118
      ->renderPriorityCode($el, $doc)
119
      ->renderLanguageCode($el, $doc)
120
      ->renderMethodCodes($el, $doc)
121
      ->renderApproachSiteCodes($el, $doc)
122
      ->renderTargetSiteCodes($el, $doc)
123
      ->renderSubject($el, $doc)
124
      ->renderSpecimens($el, $doc)
125
      ->renderPerformers($el, $doc)
126
      ->renderAuthors($el, $doc)
127
      ->renderInformants($el, $doc)
128
      ->renderParticipants($el, $doc)
129
      ->renderEntryRelationships($el, $doc)
130
      ->renderReferences($el, $doc)
131
      ->renderPreconditions($el, $doc);
132
    return $el;
133
  }
134
135
136
  /**
137
   * get the element tag name
138
   *
139
   * @return string
140
   */
141
  protected function getElementTag (): string
142
  {
143
    return 'procedure';
144
  }
145
}