Organization   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 13
dl 0
loc 41
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A hasAsEntityIdentifier() 0 3 1
A toDOMElement() 0 6 1
1
<?php
2
/**
3
 * The MIT License
4
 *
5
 * Copyright 2016 julien.
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\Entity;
27
28
use i3Soft\CDA\DataType\Collection\Set;
29
use i3Soft\CDA\Elements\Id;
30
use i3Soft\CDA\Interfaces\ClassCodeInterface;
31
use i3Soft\CDA\Traits\AddrsTrait;
32
use i3Soft\CDA\Traits\AsEntityIdentifierTrait;
33
use i3Soft\CDA\Traits\TelecomsTrait;
34
35
/**
36
 * @author julien
37
 */
38
abstract class Organization extends Entity
39
{
40
  use TelecomsTrait;
41
  use AddrsTrait;
42
  use AsEntityIdentifierTrait;
43
44
45
  /**
46
   * Organization constructor.
47
   *
48
   * @param Set $names
49
   * @param Id  $id
50
   */
51
  public function __construct (Set $names, Id $id)
52
  {
53
    $this->setNames($names)
54
      ->addId($id)
55
      ->setAcceptableClassCodes(ClassCodeInterface::EntityClassOrganization)
56
      ->setClassCode(ClassCodeInterface::ORGANISATION);
57
  }
58
59
60
  /**
61
   * @param \DOMDocument $doc
62
   *
63
   * @return \DOMElement
64
   */
65
  public function toDOMElement (\DOMDocument $doc): \DOMElement
66
  {
67
    $el = $this->createElement($doc);
68
    $this->renderIds($el, $doc);
69
    $this->renderNames($el, $doc);
70
    return $el;
71
  }
72
73
  /**
74
   * @return bool
75
   */
76
  protected function hasAsEntityIdentifier (): bool
77
  {
78
    return NULL !== $this->as_entity_identifier;
79
  }
80
81
}
82