Act   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 42
dl 0
loc 69
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A toDOMElement() 0 19 1
A getElementTag() 0 3 1
A __construct() 0 6 1
1
<?php
2
/**
3
 * The MIT License
4
 *
5
 * Copyright 2017 Julien Fastré <[email protected]>.
6
 *
7
 * Permission is hereby granted, free of charge, to any person obtaining a copy
8
 * of this software and associated documentation files (the "Software"), to deal
9
 * in the Software without restriction, including without limitation the rights
10
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
 * copies of the Software, and to permit persons to whom the Software is
12
 * furnished to do so, subject to the following conditions:
13
 *
14
 * The above copyright notice and this permission notice shall be included in
15
 * all copies or substantial portions of the Software.
16
 *
17
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
 * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE
20
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
 * THE SOFTWARE.
24
 */
25
26
namespace i3Soft\CDA\RIM\Act;
27
28
use i3Soft\CDA\Elements\AbstractElement;
29
use i3Soft\CDA\Interfaces\ClassCodeInterface;
30
use i3Soft\CDA\Interfaces\MoodCodeInterface;
31
use i3Soft\CDA\Interfaces\NegationInterface;
32
use i3Soft\CDA\Traits\AuthorsTrait;
33
use i3Soft\CDA\Traits\ClassCodeTrait;
34
use i3Soft\CDA\Traits\CodeTrait;
35
use i3Soft\CDA\Traits\EffectiveTimeTrait;
36
use i3Soft\CDA\Traits\EntryRelationshipsTrait;
37
use i3Soft\CDA\Traits\IdsTrait;
38
use i3Soft\CDA\Traits\InformantsTrait;
39
use i3Soft\CDA\Traits\LanguageCodeTrait;
40
use i3Soft\CDA\Traits\MoodCodeTrait;
41
use i3Soft\CDA\Traits\NegationIndTrait;
42
use i3Soft\CDA\Traits\ParticipantsTrait;
43
use i3Soft\CDA\Traits\PerformersTrait;
44
use i3Soft\CDA\Traits\PreconditionsTrait;
45
use i3Soft\CDA\Traits\PriorityCodeTrait;
46
use i3Soft\CDA\Traits\ReferencesTrait;
47
use i3Soft\CDA\Traits\SpecimensTrait;
48
use i3Soft\CDA\Traits\StatusCodeTrait;
49
use i3Soft\CDA\Traits\SubjectTrait;
50
use i3Soft\CDA\Traits\TextTrait;
51
52
/**
53
 * A record of something that is being done, has been done, can be done,
54
 * or is intended or requested to be done.
55
 *
56
 * @author Julien Fastré <[email protected]>
57
 */
58
class Act extends AbstractElement implements ClassCodeInterface, MoodCodeInterface, NegationInterface
59
{
60
  use IdsTrait;
61
  use CodeTrait;
62
  use TextTrait;
63
  use StatusCodeTrait;
64
  use EffectiveTimeTrait;
65
  use PriorityCodeTrait;
66
  use LanguageCodeTrait;
67
  use SubjectTrait;
68
  use SpecimensTrait;
69
  use PerformersTrait;
70
  use AuthorsTrait;
71
  use InformantsTrait;
72
  use ParticipantsTrait;
73
  use EntryRelationshipsTrait;
74
  use ReferencesTrait;
75
  use PreconditionsTrait;
76
77
  use ClassCodeTrait;
78
  use MoodCodeTrait;
79
  use NegationIndTrait;
80
81
  /**
82
   * Act constructor.
83
   *
84
   */
85
  public function __construct ()
86
  {
87
    $this->setAcceptableClassCodes(ClassCodeInterface::x_ActClassDocumentEntryAct)
88
      ->setAcceptableMoodCodes(MoodCodeInterface::x_DocumentActMood)
89
      ->setMoodCode(MoodCodeInterface::EVENT)
90
      ->setClassCode(ClassCodeInterface::ACT);
91
  }
92
93
94
  /**
95
   * @param \DOMDocument $doc
96
   *
97
   * @return \DOMElement
98
   */
99
  public function toDOMElement (\DOMDocument $doc): \DOMElement
100
  {
101
    $el = $this->createElement($doc);
102
    $this->renderIds($el, $doc);
103
    $this->renderCode($el, $doc);
104
    $this->renderText($el, $doc);
105
    $this->renderStatusCode($el, $doc);
106
    $this->renderEffectiveTime($el, $doc);
107
    $this->renderPriorityCode($el, $doc);
108
    $this->renderLanguageCode($el, $doc);
109
    $this->renderSubject($el, $doc);
110
    $this->renderSpecimens($el, $doc);
111
    $this->renderPerformers($el, $doc);
112
    $this->renderAuthors($el, $doc);
113
    $this->renderParticipants($el, $doc);
114
    $this->renderEntryRelationships($el, $doc);
115
    $this->renderReferences($el, $doc);
116
    $this->renderPreconditions($el, $doc);
117
    return $el;
118
  }
119
120
121
  /**
122
   * @return string
123
   */
124
  protected function getElementTag (): string
125
  {
126
    return 'act';
127
  }
128
129
}
130