Input   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 67
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getLabel() 0 3 1
A getName() 0 3 1
A getType() 0 3 1
A __construct() 0 5 1
A toDMN() 0 8 1
1
<?php
2
3
namespace SteffenBrand\DmnDecisionTables\Model;
4
5
/**
6
 * Class Input
7
 * @package SteffenBrand\DmnDecisionTables\Model
8
 */
9
class Input implements DmnConvertibleInterface
10
{
11
    /**
12
     * @var string
13
     */
14
    private $label;
15
16
    /**
17
     * @var string
18
     */
19
    private $name;
20
21
    /**
22
     * @var string
23
     */
24
    private $type;
25
26
    /**
27
     * Input constructor.
28
     * @param string $label
29
     * @param string $name
30
     * @param string $type
31
     */
32
    public function __construct($label, $name, $type)
33
    {
34
        $this->label = $label;
35
        $this->name = $name;
36
        $this->type = $type;
37
    }
38
39
    /**
40
     * Returns an XML representation of an input.
41
     *
42
     * @return string
43
     */
44
    public function toDMN()
45
    {
46
        return
47
            '<input id="' . uniqid('input') . '" label="' . $this->label . '">' .
48
                '<inputExpression id="' . uniqid('inputExpression') . '" typeRef="' . $this->type . '">' .
49
                    '<text>' . $this->name . '</text>' .
50
                '</inputExpression>' .
51
            '</input>';
52
    }
53
54
    /**
55
     * @return string
56
     */
57
    public function getLabel()
58
    {
59
        return $this->label;
60
    }
61
62
    /**
63
     * @return string
64
     */
65
    public function getName()
66
    {
67
        return $this->name;
68
    }
69
70
    /**
71
     * @return string
72
     */
73
    public function getType()
74
    {
75
        return $this->type;
76
    }
77
}