Passed
Push — master ( bc609e...49bb39 )
by Alex
03:56
created

TConditionType::setName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace AlgoWeb\ODataMetadata\MetadataV3\mapping\cs;
4
5
use AlgoWeb\ODataMetadata\IsOK;
6
use AlgoWeb\ODataMetadata\MetadataV4\edm\IsOKTraits\TSimpleIdentifierTrait;
7
8
/**
9
 * Class representing TConditionType
10
 *
11
 *
12
 * XSD Type: TCondition
13
 */
14
class TConditionType extends IsOK
15
{
16
    use TSimpleIdentifierTrait;
17
    /**
18
     * @property string $value
19
     */
20
    private $value = null;
21
22
    /**
23
     * @property string $name
24
     */
25
    private $name = null;
26
27
    /**
28
     * @property string $columnName
29
     */
30
    private $columnName = null;
31
32
    /**
33
     * @property boolean $isNull
34
     */
35
    private $isNull = null;
36
37
    /**
38
     * Gets as value
39
     *
40
     * @return string
41
     */
42
    public function getValue()
43
    {
44
        return $this->value;
45
    }
46
47
    /**
48
     * Sets a new value
49
     *
50
     * @param string $value
51
     * @return self
52
     */
53
    public function setValue($value)
54
    {
55
        $this->value = $value;
56
        return $this;
57
    }
58
59
    /**
60
     * Gets as name
61
     *
62
     * @return string
63
     */
64
    public function getName()
65
    {
66
        return $this->name;
67
    }
68
69
    /**
70
     * Sets a new name
71
     *
72
     * @param string $name
73
     * @return self
74
     */
75
    public function setName($name)
76
    {
77
        $this->name = $name;
78
        return $this;
79
    }
80
81
    /**
82
     * Gets as columnName
83
     *
84
     * @return string
85
     */
86
    public function getColumnName()
87
    {
88
        return $this->columnName;
89
    }
90
91
    /**
92
     * Sets a new columnName
93
     *
94
     * @param string $columnName
95
     * @return self
96
     */
97
    public function setColumnName($columnName)
98
    {
99
        $this->columnName = $columnName;
100
        return $this;
101
    }
102
103
    /**
104
     * Gets as isNull
105
     *
106
     * @return boolean
107
     */
108
    public function getIsNull()
109
    {
110
        return $this->isNull;
111
    }
112
113
    /**
114
     * Sets a new isNull
115
     *
116
     * @param boolean $isNull
117
     * @return self
118
     */
119
    public function setIsNull($isNull)
120
    {
121
        $this->isNull = $isNull;
122
        return $this;
123
    }
124
125
    public function isOK(&$msg = null)
126
    {
127
        if (null != $this->name) {
128
            if (!$this->isStringNotNullOrEmpty($this->name)) {
129
                $msg = 'Name cannot be empty';
130
                return false;
131
            }
132
            if (!$this->isTSimpleIdentifierValid($this->name)) {
133
                $msg = 'Name must be a valid TSimpleIdentifier';
134
                return false;
135
            }
136
        }
137
        if (null != $this->columnName) {
138
            if (!$this->isStringNotNullOrEmpty($this->columnName)) {
139
                $msg = 'Column name cannot be empty';
140
                return false;
141
            }
142
        }
143
        if (null != $this->value) {
144
            if (!$this->isStringNotNullOrEmpty($this->value)) {
145
                $msg = 'Value cannot be empty';
146
                return false;
147
            }
148
        }
149
        return true;
150
    }
151
}
152