Completed
Push — master ( 988df8...b0f242 )
by Piotr
03:56
created

WSDLBuilder   B

Complexity

Total Complexity 17

Size/Duplication

Total Lines 200
Duplicated Lines 0 %

Coupling/Cohesion

Components 8
Dependencies 1

Importance

Changes 4
Bugs 0 Features 3
Metric Value
wmc 17
c 4
b 0
f 3
lcom 8
cbo 1
dl 0
loc 200
rs 7.6923

17 Methods

Rating   Name   Duplication   Size   Complexity  
A instance() 0 4 1
A getName() 0 4 1
A setName() 0 6 1
A getTargetNamespace() 0 4 1
A setTargetNamespace() 0 6 1
A getNs() 0 4 1
A setNs() 0 6 1
A getLocation() 0 4 1
A setLocation() 0 6 1
A getStyle() 0 4 1
A setStyle() 0 6 1
A getUse() 0 4 1
A setUse() 0 6 1
A getSoapVersion() 0 4 1
A setSoapVersion() 0 6 1
A getMethods() 0 4 1
A setMethod() 0 5 1
1
<?php
2
/**
3
 * Copyright (C) 2013-2016
4
 * Piotr Olaszewski <[email protected]>
5
 *
6
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7
 * of this software and associated documentation files (the "Software"), to deal
8
 * in the Software without restriction, including without limitation the rights
9
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
 * copies of the Software, and to permit persons to whom the Software is
11
 * furnished to do so, subject to the following conditions:
12
 *
13
 * The above copyright notice and this permission notice shall be included in
14
 * all copies or substantial portions of the Software.
15
 *
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
 * SOFTWARE.
23
 */
24
namespace WSDL\Builder;
25
26
use InvalidArgumentException;
27
use WSDL\Annotation\BindingType;
28
use WSDL\Annotation\SoapBinding;
29
30
/**
31
 * WSDLBuilder
32
 *
33
 * @author Piotr Olaszewski <[email protected]>
34
 */
35
class WSDLBuilder
36
{
37
    /**
38
     * @var string
39
     */
40
    private $name;
41
    /**
42
     * @var string
43
     */
44
    private $targetNamespace;
45
    /**
46
     * @var string
47
     */
48
    private $ns;
49
    /**
50
     * @var string
51
     */
52
    private $location;
53
    /**
54
     * @var string
55
     */
56
    private $style = SoapBinding::RPC;
57
    /**
58
     * @var string
59
     */
60
    private $use = SoapBinding::LITERAL;
61
    /**
62
     * @var string
63
     */
64
    private $soapVersion = BindingType::SOAP_11;
65
    /**
66
     * @var Method[]
67
     */
68
    private $methods;
69
70
    /**
71
     * @return WSDLBuilder
72
     */
73
    public static function instance()
74
    {
75
        return new self();
76
    }
77
78
    /**
79
     * @return string
80
     */
81
    public function getName()
82
    {
83
        return $this->name;
84
    }
85
86
    /**
87
     * @param string $name
88
     * @return $this
89
     * @throws InvalidArgumentException
90
     */
91
    public function setName($name)
92
    {
93
        IsValid::notEmpty($name, 'Name cannot be empty');
94
        $this->name = $name;
95
        return $this;
96
    }
97
98
    /**
99
     * @return string
100
     */
101
    public function getTargetNamespace()
102
    {
103
        return $this->targetNamespace;
104
    }
105
106
    /**
107
     * @param string $targetNamespace
108
     * @return $this
109
     * @throws InvalidArgumentException
110
     */
111
    public function setTargetNamespace($targetNamespace)
112
    {
113
        IsValid::notEmpty($targetNamespace, 'Target namespace cannot be empty');
114
        $this->targetNamespace = $targetNamespace;
115
        return $this;
116
    }
117
118
    /**
119
     * @return string
120
     */
121
    public function getNs()
122
    {
123
        return $this->ns;
124
    }
125
126
    /**
127
     * @param string $ns
128
     * @return $this
129
     * @throws InvalidArgumentException
130
     */
131
    public function setNs($ns)
132
    {
133
        IsValid::notEmpty($ns, 'NS cannot be empty');
134
        $this->ns = $ns;
135
        return $this;
136
    }
137
138
    /**
139
     * @return string
140
     */
141
    public function getLocation()
142
    {
143
        return $this->location;
144
    }
145
146
    /**
147
     * @param string $location
148
     * @return $this
149
     * @throws InvalidArgumentException
150
     */
151
    public function setLocation($location)
152
    {
153
        IsValid::notEmpty($location, 'Location cannot be empty');
154
        $this->location = $location;
155
        return $this;
156
    }
157
158
    /**
159
     * @return string
160
     */
161
    public function getStyle()
162
    {
163
        return $this->style;
164
    }
165
166
    /**
167
     * @param string $style
168
     * @return $this
169
     * @throws InvalidArgumentException
170
     */
171
    public function setStyle($style)
172
    {
173
        IsValid::style($style);
174
        $this->style = $style;
175
        return $this;
176
    }
177
178
    /**
179
     * @return string
180
     */
181
    public function getUse()
182
    {
183
        return $this->use;
184
    }
185
186
    /**
187
     * @param string $use
188
     * @return $this
189
     */
190
    public function setUse($use)
191
    {
192
        IsValid::useStyle($use);
193
        $this->use = $use;
194
        return $this;
195
    }
196
197
    /**
198
     * @return string
199
     */
200
    public function getSoapVersion()
201
    {
202
        return $this->soapVersion;
203
    }
204
205
    /**
206
     * @param string $soapVersion
207
     * @return $this
208
     * @throws InvalidArgumentException
209
     */
210
    public function setSoapVersion($soapVersion)
211
    {
212
        IsValid::soapVersion($soapVersion);
213
        $this->soapVersion = $soapVersion;
214
        return $this;
215
    }
216
217
    /**
218
     * @return Method[]
219
     */
220
    public function getMethods()
221
    {
222
        return $this->methods;
223
    }
224
225
    /**
226
     * @param Method $method
227
     * @return $this
228
     */
229
    public function setMethod(Method $method)
230
    {
231
        $this->methods[] = $method;
232
        return $this;
233
    }
234
}
235