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

getTypeName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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