Issues (113)

lib/RIM/Extensions/AsEmployment.php (8 issues)

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\Extensions;
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\Interfaces\ClassCodeInterface;
40
use i3Soft\CDA\RIM\Entity\Entity;
41
use i3Soft\CDA\Traits\ExtCodeTrait;
42
use i3Soft\CDA\Traits\ExtEmployerOrganizationTrait;
43
use i3Soft\CDA\Traits\JobClassCodeTrait;
44
use i3Soft\CDA\Traits\OccupationTrait;
45
46
/**
47
 * Class AsEmployment
48
 *
49
 * @package i3Soft\CDA\RIM\Extensions
50
 */
51
class AsEmployment extends Entity
52
{
53
  use ExtCodeTrait;
54
  use OccupationTrait;
55
  use JobClassCodeTrait;
56
  use ExtEmployerOrganizationTrait;
57
58
  /**
59
   * AsEmployment constructor.
60
   *
61
   * @param null $ext_code
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $ext_code is correct as it would always require null to be passed?
Loading history...
62
   * @param null $occupation
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $occupation is correct as it would always require null to be passed?
Loading history...
63
   * @param null $job_class_code
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $job_class_code is correct as it would always require null to be passed?
Loading history...
64
   * @param null $ext_employer_organization
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $ext_employer_organization is correct as it would always require null to be passed?
Loading history...
65
   */
66
  public function __construct (
67
    $ext_code = NULL,
68
    $occupation = NULL,
69
    $job_class_code = NULL,
70
    $ext_employer_organization = NULL
71
  ) {
72
    $this->setAcceptableClassCodes(array('', ClassCodeInterface::EMPLOYMENT))
73
      ->setClassCode(ClassCodeInterface::EMPLOYMENT);
74
75
    if ($ext_code)
0 ignored issues
show
$ext_code is of type null, thus it always evaluated to false.
Loading history...
76
    {
77
      $this->setExtCode($ext_code);
78
    }
79
    if ($occupation)
0 ignored issues
show
$occupation is of type null, thus it always evaluated to false.
Loading history...
80
    {
81
      $this->setOccupation($occupation);
82
    }
83
    if ($job_class_code)
0 ignored issues
show
$job_class_code is of type null, thus it always evaluated to false.
Loading history...
84
    {
85
      $this->setJobClassCode($job_class_code);
86
    }
87
    if ($ext_employer_organization)
0 ignored issues
show
$ext_employer_organization is of type null, thus it always evaluated to false.
Loading history...
88
    {
89
      $this->setExtEmployerOrganization($ext_employer_organization);
90
    }
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->renderExtCode($el, $doc)
103
      ->renderOccupation($el, $doc)
104
      ->renderJobClassCode($el, $doc)
105
      ->renderExtEmployerOrganization($el, $doc);
106
    return $el;
107
  }
108
109
  /**
110
   * @return string
111
   */
112
  protected function getElementTag (): string
113
  {
114
    return 'ext:asEmployment';
115
  }
116
117
}