|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace WsdlToPhp\PackageGenerator\ConfigurationReader; |
|
4
|
|
|
|
|
5
|
|
|
class GeneratorOptions extends AbstractYamlReader |
|
6
|
|
|
{ |
|
7
|
|
|
/** |
|
8
|
|
|
* Common values used as option's value |
|
9
|
|
|
*/ |
|
10
|
|
|
const VALUE_CAT = 'cat'; |
|
11
|
|
|
const VALUE_END = 'end'; |
|
12
|
|
|
const VALUE_FALSE = false; |
|
13
|
|
|
const VALUE_NONE = 'none'; |
|
14
|
|
|
const VALUE_START = 'start'; |
|
15
|
|
|
const VALUE_TRUE = true; |
|
16
|
|
|
/** |
|
17
|
|
|
* Possible option keys |
|
18
|
|
|
* @var string |
|
19
|
|
|
*/ |
|
20
|
|
|
const ADD_COMMENTS = 'add_comments'; |
|
21
|
|
|
const ARRAYS_FOLDER = 'arrays_folder'; |
|
22
|
|
|
const BASIC_LOGIN = 'basic_login'; |
|
23
|
|
|
const BASIC_PASSWORD = 'basic_password'; |
|
24
|
|
|
const CATEGORY = 'category'; |
|
25
|
|
|
const COMPOSER_NAME = 'composer_name'; |
|
26
|
|
|
const COMPOSER_SETTINGS = 'composer_settings'; |
|
27
|
|
|
const DESTINATION = 'destination'; |
|
28
|
|
|
const ENUMS_FOLDER = 'enums_folder'; |
|
29
|
|
|
const GATHER_METHODS = 'gather_methods'; |
|
30
|
|
|
const GENERATE_TUTORIAL_FILE = 'generate_tutorial_file'; |
|
31
|
|
|
const GENERIC_CONSTANTS_NAME = 'generic_constants_names'; |
|
32
|
|
|
const NAMESPACE_PREFIX = 'namespace_prefix'; |
|
33
|
|
|
const ORIGIN = 'origin'; |
|
34
|
|
|
const PREFIX = 'prefix'; |
|
35
|
|
|
const PROXY_HOST = 'proxy_host'; |
|
36
|
|
|
const PROXY_LOGIN = 'proxy_login'; |
|
37
|
|
|
const PROXY_PASSWORD = 'proxy_password'; |
|
38
|
|
|
const PROXY_PORT = 'proxy_port'; |
|
39
|
|
|
const SERVICES_FOLDER = 'services_folder'; |
|
40
|
|
|
const SOAP_CLIENT_CLASS = 'soap_client_class'; |
|
41
|
|
|
const SOAP_OPTIONS = 'soap_options'; |
|
42
|
|
|
const STANDALONE = 'standalone'; |
|
43
|
|
|
const STRUCT_ARRAY_CLASS = 'struct_array_class'; |
|
44
|
|
|
const STRUCT_CLASS = 'struct_class'; |
|
45
|
|
|
const STRUCTS_FOLDER = 'structs_folder'; |
|
46
|
|
|
const SUFFIX = 'suffix'; |
|
47
|
|
|
const VALIDATION = 'validation'; |
|
48
|
|
|
/** |
|
49
|
|
|
* Generator's options |
|
50
|
|
|
* @var array |
|
51
|
|
|
*/ |
|
52
|
|
|
protected $options; |
|
53
|
|
|
/** |
|
54
|
|
|
* @param string $filename |
|
55
|
|
|
*/ |
|
56
|
36 |
|
protected function __construct($filename) |
|
57
|
|
|
{ |
|
58
|
36 |
|
$this->options = array(); |
|
59
|
36 |
|
$this->parseOptions($filename); |
|
60
|
32 |
|
} |
|
61
|
|
|
/** |
|
62
|
|
|
* Parse options for generator |
|
63
|
|
|
* @param string $filename options's file to parse |
|
64
|
|
|
* @return GeneratorOptions |
|
65
|
|
|
*/ |
|
66
|
36 |
|
protected function parseOptions($filename) |
|
67
|
|
|
{ |
|
68
|
36 |
|
$options = $this->loadYaml($filename); |
|
69
|
36 |
|
if (is_array($options)) { |
|
70
|
32 |
|
$this->options = $options; |
|
71
|
16 |
|
} else { |
|
72
|
4 |
|
throw new \InvalidArgumentException(sprintf('Settings contained by "%s" are not valid as the settings are not contained by an array: "%s"', $filename, gettype($options)), __LINE__); |
|
73
|
|
|
} |
|
74
|
32 |
|
return $this; |
|
75
|
|
|
} |
|
76
|
|
|
/** |
|
77
|
|
|
* Returns the option value |
|
78
|
|
|
* @throws \InvalidArgumentException |
|
79
|
|
|
* @param string $optionName |
|
80
|
|
|
* @return mixed |
|
81
|
|
|
*/ |
|
82
|
1068 |
|
public function getOptionValue($optionName) |
|
83
|
|
|
{ |
|
84
|
1068 |
|
if (!isset($this->options[$optionName])) { |
|
85
|
4 |
|
throw new \InvalidArgumentException(sprintf('Invalid option name "%s", possible options: %s', $optionName, implode(', ', array_keys($this->options))), __LINE__); |
|
86
|
|
|
} |
|
87
|
1064 |
|
return array_key_exists('value', $this->options[$optionName]) ? $this->options[$optionName]['value'] : $this->options[$optionName]['default']; |
|
88
|
|
|
} |
|
89
|
|
|
/** |
|
90
|
|
|
* Allows to add an option and set its value |
|
91
|
|
|
* @throws \InvalidArgumentException |
|
92
|
|
|
* @param string $optionName |
|
93
|
|
|
* @return GeneratorOptions |
|
94
|
|
|
*/ |
|
95
|
808 |
|
public function setOptionValue($optionName, $optionValue, array $values = array()) |
|
96
|
|
|
{ |
|
97
|
808 |
|
if (!isset($this->options[$optionName])) { |
|
98
|
8 |
|
$this->options[$optionName] = array( |
|
99
|
8 |
|
'value' => $optionValue, |
|
100
|
8 |
|
'values' => $values, |
|
101
|
|
|
); |
|
102
|
806 |
|
} elseif (!empty($this->options[$optionName]['values']) && !in_array($optionValue, $this->options[$optionName]['values'], true)) { |
|
103
|
8 |
|
throw new \InvalidArgumentException(sprintf('Invalid value "%s" for option "%s", possible values: %s', $optionValue, $optionName, implode(', ', $this->options[$optionName]['values'])), __LINE__); |
|
104
|
|
|
} else { |
|
105
|
796 |
|
$this->options[$optionName]['value'] = $optionValue; |
|
106
|
|
|
} |
|
107
|
800 |
|
return $this; |
|
108
|
|
|
} |
|
109
|
|
|
/** |
|
110
|
|
|
* @throws \InvalidArgumentException |
|
111
|
|
|
* @param string $filename options's file to parse |
|
112
|
|
|
* @return GeneratorOptions |
|
113
|
|
|
*/ |
|
114
|
788 |
|
public static function instance($filename = null) |
|
115
|
|
|
{ |
|
116
|
788 |
|
return parent::instance(empty($filename) ? self::getDefaultConfigurationPath() : $filename); |
|
117
|
|
|
} |
|
118
|
|
|
/** |
|
119
|
|
|
* @return string |
|
120
|
|
|
*/ |
|
121
|
60 |
|
public static function getDefaultConfigurationPath() |
|
122
|
|
|
{ |
|
123
|
60 |
|
return __DIR__ . '/../resources/config/generator_options.yml'; |
|
124
|
|
|
} |
|
125
|
|
|
/** |
|
126
|
|
|
* Get category option value |
|
127
|
|
|
* @return string |
|
128
|
|
|
*/ |
|
129
|
288 |
|
public function getCategory() |
|
130
|
|
|
{ |
|
131
|
288 |
|
return $this->getOptionValue(self::CATEGORY); |
|
132
|
|
|
} |
|
133
|
|
|
/** |
|
134
|
|
|
* Set current category option value |
|
135
|
|
|
* @throws \InvalidArgumentException |
|
136
|
|
|
* @param string $category |
|
137
|
|
|
* @return GeneratorOptions |
|
138
|
|
|
*/ |
|
139
|
300 |
|
public function setCategory($category) |
|
140
|
|
|
{ |
|
141
|
300 |
|
return $this->setOptionValue(self::CATEGORY, $category); |
|
142
|
|
|
} |
|
143
|
|
|
/** |
|
144
|
|
|
* Get add comments option value |
|
145
|
|
|
* @return array |
|
146
|
|
|
*/ |
|
147
|
216 |
|
public function getAddComments() |
|
148
|
|
|
{ |
|
149
|
216 |
|
return $this->getOptionValue(self::ADD_COMMENTS); |
|
150
|
|
|
} |
|
151
|
|
|
/** |
|
152
|
|
|
* Set current add comments option value |
|
153
|
|
|
* @throws \InvalidArgumentException |
|
154
|
|
|
* @param array $addComments |
|
155
|
|
|
* @return GeneratorOptions |
|
156
|
|
|
*/ |
|
157
|
340 |
|
public function setAddComments(array $addComments = array()) |
|
158
|
|
|
{ |
|
159
|
|
|
/** |
|
160
|
|
|
* If array is type array("author:john Doe","Release:1",) |
|
161
|
|
|
*/ |
|
162
|
340 |
|
$comments = array(); |
|
163
|
340 |
|
foreach ($addComments as $index => $value) { |
|
164
|
284 |
|
if (is_numeric($index) && strpos($value, ':') > 0) { |
|
165
|
4 |
|
list($tag, $val) = explode(':', $value); |
|
166
|
4 |
|
$comments[$tag] = $val; |
|
167
|
2 |
|
} else { |
|
168
|
282 |
|
$comments[$index] = $value; |
|
169
|
|
|
} |
|
170
|
170 |
|
} |
|
171
|
340 |
|
return $this->setOptionValue(self::ADD_COMMENTS, $comments); |
|
172
|
|
|
} |
|
173
|
|
|
/** |
|
174
|
|
|
* Get gather methods option value |
|
175
|
|
|
* @return string |
|
176
|
|
|
*/ |
|
177
|
484 |
|
public function getGatherMethods() |
|
178
|
|
|
{ |
|
179
|
484 |
|
return $this->getOptionValue(self::GATHER_METHODS); |
|
180
|
|
|
} |
|
181
|
|
|
/** |
|
182
|
|
|
* Set current gather methods option value |
|
183
|
|
|
* @throws \InvalidArgumentException |
|
184
|
|
|
* @param string $gatherMethods |
|
185
|
|
|
* @return GeneratorOptions |
|
186
|
|
|
*/ |
|
187
|
300 |
|
public function setGatherMethods($gatherMethods) |
|
188
|
|
|
{ |
|
189
|
300 |
|
return $this->setOptionValue(self::GATHER_METHODS, $gatherMethods); |
|
190
|
|
|
} |
|
191
|
|
|
/** |
|
192
|
|
|
* Get generate tutorial file option value |
|
193
|
|
|
* @return bool |
|
194
|
|
|
*/ |
|
195
|
36 |
|
public function getGenerateTutorialFile() |
|
196
|
|
|
{ |
|
197
|
36 |
|
return $this->getOptionValue(self::GENERATE_TUTORIAL_FILE); |
|
198
|
|
|
} |
|
199
|
|
|
/** |
|
200
|
|
|
* Set current generate tutorial file option value |
|
201
|
|
|
* @throws \InvalidArgumentException |
|
202
|
|
|
* @param bool $generateTutorialFile |
|
203
|
|
|
* @return GeneratorOptions |
|
204
|
|
|
*/ |
|
205
|
56 |
|
public function setGenerateTutorialFile($generateTutorialFile) |
|
206
|
|
|
{ |
|
207
|
56 |
|
return $this->setOptionValue(self::GENERATE_TUTORIAL_FILE, $generateTutorialFile); |
|
208
|
|
|
} |
|
209
|
|
|
/** |
|
210
|
|
|
* Get namespace option value |
|
211
|
|
|
* @return string |
|
212
|
|
|
*/ |
|
213
|
264 |
|
public function getNamespace() |
|
214
|
|
|
{ |
|
215
|
264 |
|
return $this->getOptionValue(self::NAMESPACE_PREFIX); |
|
216
|
|
|
} |
|
217
|
|
|
/** |
|
218
|
|
|
* Set current namespace option value |
|
219
|
|
|
* @throws \InvalidArgumentException |
|
220
|
|
|
* @param string $namespace |
|
221
|
|
|
* @return GeneratorOptions |
|
222
|
|
|
*/ |
|
223
|
44 |
|
public function setNamespace($namespace) |
|
224
|
|
|
{ |
|
225
|
44 |
|
return $this->setOptionValue(self::NAMESPACE_PREFIX, $namespace); |
|
226
|
|
|
} |
|
227
|
|
|
/** |
|
228
|
|
|
* Get generic constants name option value |
|
229
|
|
|
* @return bool |
|
230
|
|
|
*/ |
|
231
|
68 |
|
public function getGenericConstantsName() |
|
232
|
|
|
{ |
|
233
|
68 |
|
return $this->getOptionValue(self::GENERIC_CONSTANTS_NAME); |
|
234
|
|
|
} |
|
235
|
|
|
/** |
|
236
|
|
|
* Set current generic constants name option value |
|
237
|
|
|
* @throws \InvalidArgumentException |
|
238
|
|
|
* @param bool $genericConstantsName |
|
239
|
|
|
* @return GeneratorOptions |
|
240
|
|
|
*/ |
|
241
|
56 |
|
public function setGenericConstantsName($genericConstantsName) |
|
242
|
|
|
{ |
|
243
|
56 |
|
return $this->setOptionValue(self::GENERIC_CONSTANTS_NAME, $genericConstantsName); |
|
244
|
|
|
} |
|
245
|
|
|
/** |
|
246
|
|
|
* Get standalone option value |
|
247
|
|
|
* @return bool |
|
248
|
|
|
*/ |
|
249
|
68 |
|
public function getStandalone() |
|
250
|
|
|
{ |
|
251
|
68 |
|
return $this->getOptionValue(self::STANDALONE); |
|
252
|
|
|
} |
|
253
|
|
|
/** |
|
254
|
|
|
* Set current standalone option value |
|
255
|
|
|
* @throws \InvalidArgumentException |
|
256
|
|
|
* @param bool $standalone |
|
257
|
|
|
* @return GeneratorOptions |
|
258
|
|
|
*/ |
|
259
|
32 |
|
public function setStandalone($standalone) |
|
260
|
|
|
{ |
|
261
|
32 |
|
return $this->setOptionValue(self::STANDALONE, $standalone); |
|
262
|
|
|
} |
|
263
|
|
|
/** |
|
264
|
|
|
* Get validation option value |
|
265
|
|
|
* @return bool |
|
266
|
|
|
*/ |
|
267
|
120 |
|
public function getValidation() |
|
268
|
|
|
{ |
|
269
|
120 |
|
return $this->getOptionValue(self::VALIDATION); |
|
270
|
|
|
} |
|
271
|
|
|
/** |
|
272
|
|
|
* Set current validation option value |
|
273
|
|
|
* @throws \InvalidArgumentException |
|
274
|
|
|
* @param bool $validation |
|
275
|
|
|
* @return GeneratorOptions |
|
276
|
|
|
*/ |
|
277
|
16 |
|
public function setValidation($validation) |
|
278
|
|
|
{ |
|
279
|
16 |
|
return $this->setOptionValue(self::VALIDATION, $validation); |
|
280
|
|
|
} |
|
281
|
|
|
/** |
|
282
|
|
|
* Get struct class option value |
|
283
|
|
|
* @return string |
|
284
|
|
|
*/ |
|
285
|
100 |
|
public function getStructClass() |
|
286
|
|
|
{ |
|
287
|
100 |
|
return $this->getOptionValue(self::STRUCT_CLASS); |
|
288
|
|
|
} |
|
289
|
|
|
/** |
|
290
|
|
|
* Set current struct class option value |
|
291
|
|
|
* @throws \InvalidArgumentException |
|
292
|
|
|
* @param string $structClass |
|
293
|
|
|
* @return GeneratorOptions |
|
294
|
|
|
*/ |
|
295
|
36 |
|
public function setStructClass($structClass) |
|
296
|
|
|
{ |
|
297
|
36 |
|
return $this->setOptionValue(self::STRUCT_CLASS, $structClass); |
|
298
|
|
|
} |
|
299
|
|
|
/** |
|
300
|
|
|
* Get struct array class option value |
|
301
|
|
|
* @return string |
|
302
|
|
|
*/ |
|
303
|
44 |
|
public function getStructArrayClass() |
|
304
|
|
|
{ |
|
305
|
44 |
|
return $this->getOptionValue(self::STRUCT_ARRAY_CLASS); |
|
306
|
|
|
} |
|
307
|
|
|
/** |
|
308
|
|
|
* Set current struct array class option value |
|
309
|
|
|
* @throws \InvalidArgumentException |
|
310
|
|
|
* @param string $structArrayClass |
|
311
|
|
|
* @return GeneratorOptions |
|
312
|
|
|
*/ |
|
313
|
28 |
|
public function setStructArrayClass($structArrayClass) |
|
314
|
|
|
{ |
|
315
|
28 |
|
return $this->setOptionValue(self::STRUCT_ARRAY_CLASS, $structArrayClass); |
|
316
|
|
|
} |
|
317
|
|
|
/** |
|
318
|
|
|
* Get struct array class option value |
|
319
|
|
|
* @return string |
|
320
|
|
|
*/ |
|
321
|
100 |
|
public function getSoapClientClass() |
|
322
|
|
|
{ |
|
323
|
100 |
|
return $this->getOptionValue(self::SOAP_CLIENT_CLASS); |
|
324
|
|
|
} |
|
325
|
|
|
/** |
|
326
|
|
|
* Set current struct array class option value |
|
327
|
|
|
* @throws \InvalidArgumentException |
|
328
|
|
|
* @param string $soapClientClass |
|
329
|
|
|
* @return GeneratorOptions |
|
330
|
|
|
*/ |
|
331
|
28 |
|
public function setSoapClientClass($soapClientClass) |
|
332
|
|
|
{ |
|
333
|
28 |
|
return $this->setOptionValue(self::SOAP_CLIENT_CLASS, $soapClientClass); |
|
334
|
|
|
} |
|
335
|
|
|
/** |
|
336
|
|
|
* Get origin option value |
|
337
|
|
|
* @return string |
|
338
|
|
|
*/ |
|
339
|
524 |
|
public function getOrigin() |
|
340
|
|
|
{ |
|
341
|
524 |
|
return $this->getOptionValue(self::ORIGIN); |
|
342
|
|
|
} |
|
343
|
|
|
/** |
|
344
|
|
|
* Set current origin option value |
|
345
|
|
|
* @throws \InvalidArgumentException |
|
346
|
|
|
* @param string $origin |
|
347
|
|
|
* @return GeneratorOptions |
|
348
|
|
|
*/ |
|
349
|
532 |
|
public function setOrigin($origin) |
|
350
|
|
|
{ |
|
351
|
532 |
|
return $this->setOptionValue(self::ORIGIN, $origin); |
|
352
|
|
|
} |
|
353
|
|
|
/** |
|
354
|
|
|
* Get destination option value |
|
355
|
|
|
* @return string |
|
356
|
|
|
*/ |
|
357
|
304 |
|
public function getDestination() |
|
358
|
|
|
{ |
|
359
|
304 |
|
return $this->getOptionValue(self::DESTINATION); |
|
360
|
|
|
} |
|
361
|
|
|
/** |
|
362
|
|
|
* Set current destination option value |
|
363
|
|
|
* @throws \InvalidArgumentException |
|
364
|
|
|
* @param string $destination |
|
365
|
|
|
* @return GeneratorOptions |
|
366
|
|
|
*/ |
|
367
|
536 |
|
public function setDestination($destination) |
|
368
|
|
|
{ |
|
369
|
536 |
|
return $this->setOptionValue(self::DESTINATION, $destination); |
|
370
|
|
|
} |
|
371
|
|
|
/** |
|
372
|
|
|
* Get prefix option value |
|
373
|
|
|
* @return string |
|
374
|
|
|
*/ |
|
375
|
544 |
|
public function getPrefix() |
|
376
|
|
|
{ |
|
377
|
544 |
|
return $this->getOptionValue(self::PREFIX); |
|
378
|
|
|
} |
|
379
|
|
|
/** |
|
380
|
|
|
* Set current prefix option value |
|
381
|
|
|
* @throws \InvalidArgumentException |
|
382
|
|
|
* @param string $prefix |
|
383
|
|
|
* @return GeneratorOptions |
|
384
|
|
|
*/ |
|
385
|
320 |
|
public function setPrefix($prefix) |
|
386
|
|
|
{ |
|
387
|
320 |
|
return $this->setOptionValue(self::PREFIX, $prefix); |
|
388
|
|
|
} |
|
389
|
|
|
/** |
|
390
|
|
|
* Get suffix option value |
|
391
|
|
|
* @return string |
|
392
|
|
|
*/ |
|
393
|
528 |
|
public function getSuffix() |
|
394
|
|
|
{ |
|
395
|
528 |
|
return $this->getOptionValue(self::SUFFIX); |
|
396
|
|
|
} |
|
397
|
|
|
/** |
|
398
|
|
|
* Set current suffix option value |
|
399
|
|
|
* @throws \InvalidArgumentException |
|
400
|
|
|
* @param string $suffix |
|
401
|
|
|
* @return GeneratorOptions |
|
402
|
|
|
*/ |
|
403
|
52 |
|
public function setSuffix($suffix) |
|
404
|
|
|
{ |
|
405
|
52 |
|
return $this->setOptionValue(self::SUFFIX, $suffix); |
|
406
|
|
|
} |
|
407
|
|
|
/** |
|
408
|
|
|
* Get basic login option value |
|
409
|
|
|
* @return string |
|
410
|
|
|
*/ |
|
411
|
528 |
|
public function getBasicLogin() |
|
412
|
|
|
{ |
|
413
|
528 |
|
return $this->getOptionValue(self::BASIC_LOGIN); |
|
414
|
|
|
} |
|
415
|
|
|
/** |
|
416
|
|
|
* Set current basic login option value |
|
417
|
|
|
* @throws \InvalidArgumentException |
|
418
|
|
|
* @param string $basicLogin |
|
419
|
|
|
* @return GeneratorOptions |
|
420
|
|
|
*/ |
|
421
|
28 |
|
public function setBasicLogin($basicLogin) |
|
422
|
|
|
{ |
|
423
|
28 |
|
return $this->setOptionValue(self::BASIC_LOGIN, $basicLogin); |
|
424
|
|
|
} |
|
425
|
|
|
/** |
|
426
|
|
|
* Get basic password option value |
|
427
|
|
|
* @return string |
|
428
|
|
|
*/ |
|
429
|
528 |
|
public function getBasicPassword() |
|
430
|
|
|
{ |
|
431
|
528 |
|
return $this->getOptionValue(self::BASIC_PASSWORD); |
|
432
|
|
|
} |
|
433
|
|
|
/** |
|
434
|
|
|
* Set current basic password option value |
|
435
|
|
|
* @throws \InvalidArgumentException |
|
436
|
|
|
* @param string $basicPassword |
|
437
|
|
|
* @return GeneratorOptions |
|
438
|
|
|
*/ |
|
439
|
28 |
|
public function setBasicPassword($basicPassword) |
|
440
|
|
|
{ |
|
441
|
28 |
|
return $this->setOptionValue(self::BASIC_PASSWORD, $basicPassword); |
|
442
|
|
|
} |
|
443
|
|
|
/** |
|
444
|
|
|
* Get basic proxy host option value |
|
445
|
|
|
* @return string |
|
446
|
|
|
*/ |
|
447
|
528 |
|
public function getProxyHost() |
|
448
|
|
|
{ |
|
449
|
528 |
|
return $this->getOptionValue(self::PROXY_HOST); |
|
450
|
|
|
} |
|
451
|
|
|
/** |
|
452
|
|
|
* Set current proxy host option value |
|
453
|
|
|
* @throws \InvalidArgumentException |
|
454
|
|
|
* @param string $proxyHost |
|
455
|
|
|
* @return GeneratorOptions |
|
456
|
|
|
*/ |
|
457
|
28 |
|
public function setProxyHost($proxyHost) |
|
458
|
|
|
{ |
|
459
|
28 |
|
return $this->setOptionValue(self::PROXY_HOST, $proxyHost); |
|
460
|
|
|
} |
|
461
|
|
|
/** |
|
462
|
|
|
* Get basic proxy port option value |
|
463
|
|
|
* @return string |
|
464
|
|
|
*/ |
|
465
|
528 |
|
public function getProxyPort() |
|
466
|
|
|
{ |
|
467
|
528 |
|
return $this->getOptionValue(self::PROXY_PORT); |
|
468
|
|
|
} |
|
469
|
|
|
/** |
|
470
|
|
|
* Set current proxy port option value |
|
471
|
|
|
* @throws \InvalidArgumentException |
|
472
|
|
|
* @param string $proxyPort |
|
473
|
|
|
* @return GeneratorOptions |
|
474
|
|
|
*/ |
|
475
|
28 |
|
public function setProxyPort($proxyPort) |
|
476
|
|
|
{ |
|
477
|
28 |
|
return $this->setOptionValue(self::PROXY_PORT, $proxyPort); |
|
478
|
|
|
} |
|
479
|
|
|
/** |
|
480
|
|
|
* Get basic proxy login option value |
|
481
|
|
|
* @return string |
|
482
|
|
|
*/ |
|
483
|
528 |
|
public function getProxyLogin() |
|
484
|
|
|
{ |
|
485
|
528 |
|
return $this->getOptionValue(self::PROXY_LOGIN); |
|
486
|
|
|
} |
|
487
|
|
|
/** |
|
488
|
|
|
* Set current proxy login option value |
|
489
|
|
|
* @throws \InvalidArgumentException |
|
490
|
|
|
* @param string $proxyLogin |
|
491
|
|
|
* @return GeneratorOptions |
|
492
|
|
|
*/ |
|
493
|
28 |
|
public function setProxyLogin($proxyLogin) |
|
494
|
|
|
{ |
|
495
|
28 |
|
return $this->setOptionValue(self::PROXY_LOGIN, $proxyLogin); |
|
496
|
|
|
} |
|
497
|
|
|
/** |
|
498
|
|
|
* Get basic proxy password option value |
|
499
|
|
|
* @return string |
|
500
|
|
|
*/ |
|
501
|
528 |
|
public function getProxyPassword() |
|
502
|
|
|
{ |
|
503
|
528 |
|
return $this->getOptionValue(self::PROXY_PASSWORD); |
|
504
|
|
|
} |
|
505
|
|
|
/** |
|
506
|
|
|
* Set current proxy password option value |
|
507
|
|
|
* @throws \InvalidArgumentException |
|
508
|
|
|
* @param string $proxyPassword |
|
509
|
|
|
* @return GeneratorOptions |
|
510
|
|
|
*/ |
|
511
|
28 |
|
public function setProxyPassword($proxyPassword) |
|
512
|
|
|
{ |
|
513
|
28 |
|
return $this->setOptionValue(self::PROXY_PASSWORD, $proxyPassword); |
|
514
|
|
|
} |
|
515
|
|
|
/** |
|
516
|
|
|
* Get basic soap options option value |
|
517
|
|
|
* @return array |
|
518
|
|
|
*/ |
|
519
|
520 |
|
public function getSoapOptions() |
|
520
|
|
|
{ |
|
521
|
520 |
|
return $this->getOptionValue(self::SOAP_OPTIONS); |
|
522
|
|
|
} |
|
523
|
|
|
/** |
|
524
|
|
|
* Set current soap options option value |
|
525
|
|
|
* @throws \InvalidArgumentException |
|
526
|
|
|
* @param array $soapOptions |
|
527
|
|
|
* @return GeneratorOptions |
|
528
|
|
|
*/ |
|
529
|
32 |
|
public function setSoapOptions(array $soapOptions) |
|
530
|
|
|
{ |
|
531
|
32 |
|
return $this->setOptionValue(self::SOAP_OPTIONS, $soapOptions); |
|
532
|
|
|
} |
|
533
|
|
|
/** |
|
534
|
|
|
* Get composer name option value |
|
535
|
|
|
* @return string |
|
536
|
|
|
*/ |
|
537
|
48 |
|
public function getComposerName() |
|
538
|
|
|
{ |
|
539
|
48 |
|
return $this->getOptionValue(self::COMPOSER_NAME); |
|
540
|
|
|
} |
|
541
|
|
|
/** |
|
542
|
|
|
* Set current composer name option value |
|
543
|
|
|
* @throws \InvalidArgumentException |
|
544
|
|
|
* @param string $composerName |
|
545
|
|
|
* @return GeneratorOptions |
|
546
|
|
|
*/ |
|
547
|
72 |
|
public function setComposerName($composerName) |
|
548
|
|
|
{ |
|
549
|
72 |
|
return $this->setOptionValue(self::COMPOSER_NAME, $composerName); |
|
550
|
|
|
} |
|
551
|
|
|
/** |
|
552
|
|
|
* Get composer settings option value |
|
553
|
|
|
* @return array |
|
554
|
|
|
*/ |
|
555
|
36 |
|
public function getComposerSettings() |
|
556
|
|
|
{ |
|
557
|
36 |
|
return $this->getOptionValue(self::COMPOSER_SETTINGS); |
|
558
|
|
|
} |
|
559
|
|
|
/** |
|
560
|
|
|
* Set current composer settings option value |
|
561
|
|
|
* @throws \InvalidArgumentException |
|
562
|
|
|
* @param array $composerSettings |
|
563
|
|
|
* @return GeneratorOptions |
|
564
|
|
|
*/ |
|
565
|
68 |
|
public function setComposerSettings(array $composerSettings = array()) |
|
566
|
|
|
{ |
|
567
|
|
|
/** |
|
568
|
|
|
* If array is type array("config.value:true","require:libray/src",) |
|
569
|
|
|
*/ |
|
570
|
68 |
|
$settings = array(); |
|
571
|
68 |
|
foreach ($composerSettings as $index => $value) { |
|
572
|
28 |
|
if (is_numeric($index) && strpos($value, ':') > 0) { |
|
573
|
28 |
|
$path = implode('', array_slice(explode(':', $value), 0, 1)); |
|
574
|
28 |
|
$val = implode(':', array_slice(explode(':', $value), 1)); |
|
575
|
28 |
|
self::dotNotationToArray($path, $val, $settings); |
|
576
|
14 |
|
} else { |
|
577
|
14 |
|
$settings[$index] = $value; |
|
578
|
|
|
} |
|
579
|
34 |
|
} |
|
580
|
68 |
|
return $this->setOptionValue(self::COMPOSER_SETTINGS, $settings); |
|
581
|
|
|
} |
|
582
|
|
|
/** |
|
583
|
|
|
* turns my.key.path to array('my' => array('key' => array('path' => $value))) |
|
584
|
|
|
* @param string $string |
|
585
|
|
|
* @param mixed $value |
|
586
|
|
|
* @param array $array |
|
587
|
|
|
*/ |
|
588
|
28 |
|
protected static function dotNotationToArray($string, $value, array &$array) |
|
589
|
|
|
{ |
|
590
|
28 |
|
$keys = explode('.', $string); |
|
591
|
28 |
|
foreach ($keys as $key) { |
|
592
|
28 |
|
$array = &$array[$key]; |
|
593
|
14 |
|
} |
|
594
|
28 |
|
$array = ($value === 'true' || $value === 'false') ? $value === 'true' : $value; |
|
595
|
28 |
|
} |
|
596
|
|
|
/** |
|
597
|
|
|
* Get structs folder option value |
|
598
|
|
|
* @return string |
|
599
|
|
|
*/ |
|
600
|
268 |
|
public function getStructsFolder() |
|
601
|
|
|
{ |
|
602
|
268 |
|
return $this->getOptionValue(self::STRUCTS_FOLDER); |
|
603
|
|
|
} |
|
604
|
|
|
/** |
|
605
|
|
|
* Set current structs folder option value |
|
606
|
|
|
* @throws \InvalidArgumentException |
|
607
|
|
|
* @param string $structsFolder |
|
608
|
|
|
* @return GeneratorOptions |
|
609
|
|
|
*/ |
|
610
|
28 |
|
public function setStructsFolder($structsFolder) |
|
611
|
|
|
{ |
|
612
|
28 |
|
return $this->setOptionValue(self::STRUCTS_FOLDER, $structsFolder); |
|
613
|
|
|
} |
|
614
|
|
|
/** |
|
615
|
|
|
* Get arrays folder option value |
|
616
|
|
|
* @return string |
|
617
|
|
|
*/ |
|
618
|
60 |
|
public function getArraysFolder() |
|
619
|
|
|
{ |
|
620
|
60 |
|
return $this->getOptionValue(self::ARRAYS_FOLDER); |
|
621
|
|
|
} |
|
622
|
|
|
/** |
|
623
|
|
|
* Set current arrays folder option value |
|
624
|
|
|
* @throws \InvalidArgumentException |
|
625
|
|
|
* @param string $arraysFolder |
|
626
|
|
|
* @return GeneratorOptions |
|
627
|
|
|
*/ |
|
628
|
28 |
|
public function setArraysFolder($arraysFolder) |
|
629
|
|
|
{ |
|
630
|
28 |
|
return $this->setOptionValue(self::ARRAYS_FOLDER, $arraysFolder); |
|
631
|
|
|
} |
|
632
|
|
|
/** |
|
633
|
|
|
* Get enums folder option value |
|
634
|
|
|
* @return string |
|
635
|
|
|
*/ |
|
636
|
100 |
|
public function getEnumsFolder() |
|
637
|
|
|
{ |
|
638
|
100 |
|
return $this->getOptionValue(self::ENUMS_FOLDER); |
|
639
|
|
|
} |
|
640
|
|
|
/** |
|
641
|
|
|
* Set current enums folder option value |
|
642
|
|
|
* @throws \InvalidArgumentException |
|
643
|
|
|
* @param string $enumsFolder |
|
644
|
|
|
* @return GeneratorOptions |
|
645
|
|
|
*/ |
|
646
|
28 |
|
public function setEnumsFolder($enumsFolder) |
|
647
|
|
|
{ |
|
648
|
28 |
|
return $this->setOptionValue(self::ENUMS_FOLDER, $enumsFolder); |
|
649
|
|
|
} |
|
650
|
|
|
/** |
|
651
|
|
|
* Get services folder option value |
|
652
|
|
|
* @return string |
|
653
|
|
|
*/ |
|
654
|
520 |
|
public function getServicesFolder() |
|
655
|
|
|
{ |
|
656
|
520 |
|
return $this->getOptionValue(self::SERVICES_FOLDER); |
|
657
|
|
|
} |
|
658
|
|
|
/** |
|
659
|
|
|
* Set current services folder option value |
|
660
|
|
|
* @throws \InvalidArgumentException |
|
661
|
|
|
* @param string $servicesFolder |
|
662
|
|
|
* @return GeneratorOptions |
|
663
|
|
|
*/ |
|
664
|
28 |
|
public function setServicesFolder($servicesFolder) |
|
665
|
|
|
{ |
|
666
|
28 |
|
return $this->setOptionValue(self::SERVICES_FOLDER, $servicesFolder); |
|
667
|
|
|
} |
|
668
|
|
|
/** |
|
669
|
|
|
* @return string[] |
|
670
|
|
|
*/ |
|
671
|
28 |
|
public function toArray() |
|
672
|
|
|
{ |
|
673
|
28 |
|
$options = array(); |
|
674
|
28 |
|
foreach (array_keys($this->options) as $name) { |
|
675
|
28 |
|
$options[$name] = $this->getOptionValue($name); |
|
676
|
14 |
|
} |
|
677
|
28 |
|
return $options; |
|
678
|
|
|
} |
|
679
|
|
|
} |
|
680
|
|
|
|