Passed
Push — master ( 418524...2ac80a )
by Alex
03:43
created

TDesignerType::isOK()   B

Complexity

Conditions 7
Paths 5

Size

Total Lines 21
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 7.551
c 0
b 0
f 0
cc 7
eloc 13
nc 5
nop 1
1
<?php
2
3
namespace AlgoWeb\ODataMetadata\MetadataV3\edmx;
4
5
use AlgoWeb\ODataMetadata\IsOK;
6
7
/**
8
 * Class representing TDesignerType
9
 *
10
 *
11
 * XSD Type: TDesigner
12
 */
13
class TDesignerType extends IsOK
14
{
15
16
    /**
17
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edmx\TConnectionType $connection
18
     */
19
    private $connection = null;
20
21
    /**
22
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edmx\TOptionsType $options
23
     */
24
    private $options = null;
25
26
    /**
27
     * @property \AlgoWeb\ODataMetadata\MetadataV3\edmx\TDiagramType[] $diagrams
28
     */
29
    private $diagrams = [];
30
31
    /**
32
     * Gets as connection
33
     *
34
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edmx\TConnectionType
35
     */
36
    public function getConnection()
37
    {
38
        return $this->connection;
39
    }
40
41
    /**
42
     * Sets a new connection
43
     *
44
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edmx\TConnectionType $connection
45
     * @return self
46
     */
47
    public function setConnection(TConnectionType $connection)
48
    {
49
        $this->connection = $connection;
50
        return $this;
51
    }
52
53
    /**
54
     * Gets as options
55
     *
56
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edmx\TOptionsType
57
     */
58
    public function getOptions()
59
    {
60
        return $this->options;
61
    }
62
63
    /**
64
     * Sets a new options
65
     *
66
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edmx\TOptionsType $options
67
     * @return self
68
     */
69
    public function setOptions(TOptionsType $options)
70
    {
71
        $this->options = $options;
72
        return $this;
73
    }
74
75
    /**
76
     * Adds as diagram
77
     *
78
     * @return self
79
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edmx\TDiagramType $diagram
80
     */
81
    public function addToDiagrams(TDiagramType $diagram)
82
    {
83
        $this->diagrams[] = $diagram;
84
        return $this;
85
    }
86
87
    /**
88
     * isset diagrams
89
     *
90
     * @param scalar $index
91
     * @return boolean
92
     */
93
    public function issetDiagrams($index)
94
    {
95
        return isset($this->diagrams[$index]);
96
    }
97
98
    /**
99
     * unset diagrams
100
     *
101
     * @param scalar $index
102
     * @return void
103
     */
104
    public function unsetDiagrams($index)
105
    {
106
        unset($this->diagrams[$index]);
107
    }
108
109
    /**
110
     * Gets as diagrams
111
     *
112
     * @return \AlgoWeb\ODataMetadata\MetadataV3\edmx\TDiagramType[]
113
     */
114
    public function getDiagrams()
115
    {
116
        return $this->diagrams;
117
    }
118
119
    /**
120
     * Sets a new diagrams
121
     *
122
     * @param \AlgoWeb\ODataMetadata\MetadataV3\edmx\TDiagramType[] $diagrams
123
     * @return self
124
     */
125
    public function setDiagrams(array $diagrams)
126
    {
127
        $this->diagrams = $diagrams;
128
        return $this;
129
    }
130
131
    public function isOK(&$msg = null)
132
    {
133
        if (null != $this->connection && !$this->connection->isOK($msg)) {
134
            return false;
135
        }
136
        if (null != $this->options && !$this->options->isOK($msg)) {
137
            return false;
138
        }
139
140
        if (!$this->isValidArray(
141
            $this->diagrams,
142
            '\AlgoWeb\ODataMetadata\MetadataV3\edmx\TDiagramType'
143
        )) {
144
            $msg = "Diagrams array not a valid array";
145
            return false;
146
        }
147
        if (!$this->isChildArrayOK($this->diagrams, $msg)) {
148
            return false;
149
        }
150
        return true;
151
    }
152
}
153