Issues (113)

lib/RIM/Act/SubstanceAdministration.php (1 issue)

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\Interfaces\ClassCodeInterface;
29
use i3Soft\CDA\Interfaces\MoodCodeInterface;
30
use i3Soft\CDA\RIM\Participation\Consumable;
31
use i3Soft\CDA\Traits\ApproachSiteCodesTrait;
32
use i3Soft\CDA\Traits\ConsumableTrait;
33
use i3Soft\CDA\Traits\DoseQuantityTrait;
34
use i3Soft\CDA\Traits\EffectiveTimesTrait;
35
use i3Soft\CDA\Traits\RateQuantityTrait;
36
use i3Soft\CDA\Traits\RouteCodeTrait;
37
38
/**
39
 * Class SubstanceAdministration
40
 *
41
 * @package i3Soft\CDA\RIM\Act
42
 */
43
class SubstanceAdministration extends Act
44
{
45
46
  use EffectiveTimesTrait;
47
  use RouteCodeTrait;
48
  use ApproachSiteCodesTrait;
49
  use DoseQuantityTrait;
50
  use RateQuantityTrait;
51
  use ConsumableTrait;
52
53
  /**
54
   * SubstanceAdministration constructor.
55
   *
56
   * @link https://www.hl7.org/documentcenter/public_temp_F5125FF9-1C23-BA17-0C1A72EC817E8760/standards/vocabulary/vocabulary_tables/infrastructure/vocabulary/ActClass.html
57
   *
58
   * @param null $consumable
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $consumable is correct as it would always require null to be passed?
Loading history...
59
   */
60
  public function __construct ($consumable = NULL)
61
  {
62
    parent::__construct();
63
    if ($consumable instanceof Consumable)
64
    {
65
      $this->setConsumable($consumable);
66
    }
67
    $this->setAcceptableClassCodes(ClassCodeInterface::ActClass)
68
      ->setClassCode(ClassCodeInterface::SUBSTANCE_ADMINISTRATION)
69
      ->setMoodCode(MoodCodeInterface::EVENT);
70
  }
71
72
73
  /**
74
   * @param \DOMDocument $doc
75
   *
76
   * @return \DOMElement
77
   */
78
  public function toDOMElement (\DOMDocument $doc): \DOMElement
79
  {
80
    $el = $this->createElement($doc);
81
    $this->renderIds($el, $doc)
82
      ->renderText($el, $doc)
83
      ->renderStatusCode($el, $doc)
84
      ->renderEffectiveTimes($el, $doc)
85
      ->renderRouteCode($el, $doc)
86
      ->renderDoseQuantity($el, $doc)
87
      ->renderConsumable($el, $doc)
88
      ->renderEntryRelationships($el, $doc)
89
      ->renderPreconditions($el, $doc);
90
    return $el;
91
  }
92
93
  /**
94
   * @return string
95
   */
96
  protected function getElementTag (): string
97
  {
98
    return 'substanceAdministration';
99
  }
100
101
}
102