Passed
Push — master ( ab6b67...a48167 )
by Mikaël
74:03 queued 50:14
created

GeneratorOptions::setComposerSettings()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 16
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 9
c 1
b 0
f 0
nc 3
nop 1
dl 0
loc 16
ccs 11
cts 11
cp 1
crap 4
rs 9.9666
1
<?php
2
3
namespace WsdlToPhp\PackageGenerator\ConfigurationReader;
4
5
class GeneratorOptions extends AbstractYamlReader implements \JsonSerializable
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 SRC_DIRNAME = 'src_dirname';
43
    const STANDALONE = 'standalone';
44
    const STRUCT_ARRAY_CLASS = 'struct_array_class';
45
    const STRUCT_ENUM_CLASS = 'struct_enum_class';
46
    const STRUCT_CLASS = 'struct_class';
47
    const STRUCTS_FOLDER = 'structs_folder';
48
    const SUFFIX = 'suffix';
49
    const VALIDATION = 'validation';
50
    const SCHEMAS_SAVE = 'schemas_save';
51
    const SCHEMAS_FOLDER = 'schemas_folder';
52
    const XSD_TYPES_PATH = 'xsd_types_path';
53
    /**
54
     * Generator's options
55
     * @var array
56
     */
57
    protected $options;
58
    /**
59
     * @param string $filename
60
     */
61 60
    protected function __construct($filename)
62
    {
63 60
        $this->options = [];
64 60
        $this->parseOptions($filename);
65 54
    }
66
    /**
67
     * Parse options for generator
68
     * @param string $filename options's file to parse
69
     * @return GeneratorOptions
70
     */
71 60
    protected function parseOptions($filename)
72
    {
73 60
        $options = $this->loadYaml($filename);
74 60
        if (is_array($options)) {
75 54
            $this->options = $options;
76 27
        } else {
77 6
            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__);
78
        }
79 54
        return $this;
80
    }
81
    /**
82
     * Returns the option value
83
     * @throws \InvalidArgumentException
84
     * @param string $optionName
85
     * @return mixed
86
     */
87 2100
    public function getOptionValue($optionName)
88
    {
89 2100
        if (!isset($this->options[$optionName])) {
90 6
            throw new \InvalidArgumentException(sprintf('Invalid option name "%s", possible options: %s', $optionName, implode(', ', array_keys($this->options))), __LINE__);
91
        }
92 2094
        return array_key_exists('value', $this->options[$optionName]) ? $this->options[$optionName]['value'] : $this->options[$optionName]['default'];
93
    }
94
    /**
95
     * Allows to add an option and set its value
96
     * @throws \InvalidArgumentException
97
     * @param string $optionName
98
     * @param mixed $optionValue
99
     * @param array $values
100
     * @return GeneratorOptions
101
     */
102 1530
    public function setOptionValue($optionName, $optionValue, array $values = [])
103
    {
104 1530
        if (!isset($this->options[$optionName])) {
105 12
            $this->options[$optionName] = [
106 12
                'value' => $optionValue,
107 12
                'values' => $values,
108
            ];
109 1527
        } elseif (!empty($this->options[$optionName]['values']) && !in_array($optionValue, $this->options[$optionName]['values'], true)) {
110 12
            throw new \InvalidArgumentException(sprintf('Invalid value "%s" for option "%s", possible values: %s', $optionValue, $optionName, implode(', ', $this->options[$optionName]['values'])), __LINE__);
111
        } else {
112 1512
            $this->options[$optionName]['value'] = $optionValue;
113
        }
114 1518
        return $this;
115
    }
116
    /**
117
     * @throws \InvalidArgumentException
118
     * @param string $filename options's file to parse
119
     * @return GeneratorOptions
120
     */
121 1506
    public static function instance($filename = null)
122
    {
123 1506
        return parent::instance(empty($filename) ? self::getDefaultConfigurationPath() : $filename);
124
    }
125
    /**
126
     * @return string
127
     */
128 642
    public static function getDefaultConfigurationPath()
129
    {
130 642
        return __DIR__ . '/../resources/config/generator_options.yml';
131
    }
132
    /**
133
     * Get category option value
134
     * @return string
135
     */
136 684
    public function getCategory()
137
    {
138 684
        return $this->getOptionValue(self::CATEGORY);
139
    }
140
    /**
141
     * Set current category option value
142
     * @throws \InvalidArgumentException
143
     * @param string $category
144
     * @return GeneratorOptions
145
     */
146 54
    public function setCategory($category)
147
    {
148 54
        return $this->setOptionValue(self::CATEGORY, $category);
149
    }
150
    /**
151
     * Get add comments option value
152
     * @return array
153
     */
154 480
    public function getAddComments()
155
    {
156 480
        return $this->getOptionValue(self::ADD_COMMENTS);
157
    }
158
    /**
159
     * Set current add comments option value
160
     * @throws \InvalidArgumentException
161
     * @param array $addComments
162
     * @return GeneratorOptions
163
     */
164 114
    public function setAddComments(array $addComments = [])
165
    {
166
        /**
167
         * If array is type array("author:john Doe","Release:1",)
168
         */
169 114
        $comments = [];
170 114
        foreach ($addComments as $index => $value) {
171 24
            if (is_numeric($index) && mb_strpos($value, ':') > 0) {
172 6
                list($tag, $val) = explode(':', $value);
173 6
                $comments[$tag] = $val;
174 3
            } else {
175 20
                $comments[$index] = $value;
176
            }
177 57
        }
178 114
        return $this->setOptionValue(self::ADD_COMMENTS, $comments);
179
    }
180
    /**
181
     * Get gather methods option value
182
     * @return string
183
     */
184 540
    public function getGatherMethods()
185
    {
186 540
        return $this->getOptionValue(self::GATHER_METHODS);
187
    }
188
    /**
189
     * Set current gather methods option value
190
     * @throws \InvalidArgumentException
191
     * @param string $gatherMethods
192
     * @return GeneratorOptions
193
     */
194 48
    public function setGatherMethods($gatherMethods)
195
    {
196 48
        return $this->setOptionValue(self::GATHER_METHODS, $gatherMethods);
197
    }
198
    /**
199
     * Get generate tutorial file option value
200
     * @return bool
201
     */
202 60
    public function getGenerateTutorialFile()
203
    {
204 60
        return $this->getOptionValue(self::GENERATE_TUTORIAL_FILE);
205
    }
206
    /**
207
     * Set current generate tutorial file option value
208
     * @throws \InvalidArgumentException
209
     * @param bool $generateTutorialFile
210
     * @return GeneratorOptions
211
     */
212 90
    public function setGenerateTutorialFile($generateTutorialFile)
213
    {
214 90
        return $this->setOptionValue(self::GENERATE_TUTORIAL_FILE, $generateTutorialFile);
215
    }
216
    /**
217
     * Get namespace option value
218
     * @return string
219
     */
220 648
    public function getNamespace()
221
    {
222 648
        return $this->getOptionValue(self::NAMESPACE_PREFIX);
223
    }
224
    /**
225
     * Set current namespace option value
226
     * @throws \InvalidArgumentException
227
     * @param string $namespace
228
     * @return GeneratorOptions
229
     */
230 66
    public function setNamespace($namespace)
231
    {
232 66
        return $this->setOptionValue(self::NAMESPACE_PREFIX, $namespace);
233
    }
234
    /**
235
     * Get generic constants name option value
236
     * @return bool
237
     */
238 156
    public function getGenericConstantsName()
239
    {
240 156
        return $this->getOptionValue(self::GENERIC_CONSTANTS_NAME);
241
    }
242
    /**
243
     * Set current generic constants name option value
244
     * @throws \InvalidArgumentException
245
     * @param bool $genericConstantsName
246
     * @return GeneratorOptions
247
     */
248 90
    public function setGenericConstantsName($genericConstantsName)
249
    {
250 90
        return $this->setOptionValue(self::GENERIC_CONSTANTS_NAME, $genericConstantsName);
251
    }
252
    /**
253
     * Get standalone option value
254
     * @return bool
255
     */
256 114
    public function getStandalone()
257
    {
258 114
        return $this->getOptionValue(self::STANDALONE);
259
    }
260
    /**
261
     * Set current standalone option value
262
     * @throws \InvalidArgumentException
263
     * @param bool $standalone
264
     * @return GeneratorOptions
265
     */
266 54
    public function setStandalone($standalone)
267
    {
268 54
        return $this->setOptionValue(self::STANDALONE, $standalone);
269
    }
270
    /**
271
     * Get validation option value
272
     * @return bool
273
     */
274 318
    public function getValidation()
275
    {
276 318
        return $this->getOptionValue(self::VALIDATION);
277
    }
278
    /**
279
     * Set current validation option value
280
     * @throws \InvalidArgumentException
281
     * @param bool $validation
282
     * @return GeneratorOptions
283
     */
284 66
    public function setValidation($validation)
285
    {
286 66
        return $this->setOptionValue(self::VALIDATION, $validation);
287
    }
288
    /**
289
     * Get struct class option value
290
     * @return string
291
     */
292 294
    public function getStructClass()
293
    {
294 294
        return $this->getOptionValue(self::STRUCT_CLASS);
295
    }
296
    /**
297
     * Set current struct class option value
298
     * @throws \InvalidArgumentException
299
     * @param string $structClass
300
     * @return GeneratorOptions
301
     */
302 54
    public function setStructClass($structClass)
303
    {
304 54
        return $this->setOptionValue(self::STRUCT_CLASS, $structClass);
305
    }
306
    /**
307
     * Get struct array class option value
308
     * @return string
309
     */
310 72
    public function getStructArrayClass()
311
    {
312 72
        return $this->getOptionValue(self::STRUCT_ARRAY_CLASS);
313
    }
314
    /**
315
     * Set current struct array class option value
316
     * @throws \InvalidArgumentException
317
     * @param string $structArrayClass
318
     * @return GeneratorOptions
319
     */
320 42
    public function setStructArrayClass($structArrayClass)
321
    {
322 42
        return $this->setOptionValue(self::STRUCT_ARRAY_CLASS, $structArrayClass);
323
    }
324
    /**
325
     * Get struct enum class option value
326
     * @return string
327
     */
328 150
    public function getStructEnumClass()
329
    {
330 150
        return $this->getOptionValue(self::STRUCT_ENUM_CLASS);
331
    }
332
    /**
333
     * Set current struct enum class option value
334
     * @throws \InvalidArgumentException
335
     * @param string $structEnumClass
336
     * @return GeneratorOptions
337
     */
338 12
    public function setStructEnumClass($structEnumClass)
339
    {
340 12
        return $this->setOptionValue(self::STRUCT_ENUM_CLASS, $structEnumClass);
341
    }
342
    /**
343
     * Get struct array class option value
344
     * @return string
345
     */
346 162
    public function getSoapClientClass()
347
    {
348 162
        return $this->getOptionValue(self::SOAP_CLIENT_CLASS);
349
    }
350
    /**
351
     * Set current struct array class option value
352
     * @throws \InvalidArgumentException
353
     * @param string $soapClientClass
354
     * @return GeneratorOptions
355
     */
356 42
    public function setSoapClientClass($soapClientClass)
357
    {
358 42
        return $this->setOptionValue(self::SOAP_CLIENT_CLASS, $soapClientClass);
359
    }
360
    /**
361
     * Get origin option value
362
     * @return string
363
     */
364 1068
    public function getOrigin()
365
    {
366 1068
        return $this->getOptionValue(self::ORIGIN);
367
    }
368
    /**
369
     * Set current origin option value
370
     * @throws \InvalidArgumentException
371
     * @param string $origin
372
     * @return GeneratorOptions
373
     */
374 534
    public function setOrigin($origin)
375
    {
376 534
        return $this->setOptionValue(self::ORIGIN, $origin);
377
    }
378
    /**
379
     * Get destination option value
380
     * @return string
381
     */
382 642
    public function getDestination()
383
    {
384 642
        return $this->getOptionValue(self::DESTINATION);
385
    }
386
    /**
387
     * Set current destination option value
388
     * @throws \InvalidArgumentException
389
     * @param string $destination
390
     * @return GeneratorOptions
391
     */
392 540
    public function setDestination($destination)
393
    {
394 540
        return $this->setOptionValue(self::DESTINATION, $destination);
395
    }
396
    /**
397
     * Get src dirname option value
398
     * @return string
399
     */
400 564
    public function getSrcDirname()
401
    {
402 564
        return $this->getOptionValue(self::SRC_DIRNAME);
403
    }
404
    /**
405
     * Set current src dirname option value
406
     * @throws \InvalidArgumentException
407
     * @param string $srcDirname
408
     * @return GeneratorOptions
409
     */
410 30
    public function setSrcDirname($srcDirname)
411
    {
412 30
        return $this->setOptionValue(self::SRC_DIRNAME, $srcDirname);
413
    }
414
    /**
415
     * Get prefix option value
416
     * @return string
417
     */
418 1200
    public function getPrefix()
419
    {
420 1200
        return $this->getOptionValue(self::PREFIX);
421
    }
422
    /**
423
     * Set current prefix option value
424
     * @throws \InvalidArgumentException
425
     * @param string $prefix
426
     * @return GeneratorOptions
427
     */
428 162
    public function setPrefix($prefix)
429
    {
430 162
        return $this->setOptionValue(self::PREFIX, $prefix);
431
    }
432
    /**
433
     * Get suffix option value
434
     * @return string
435
     */
436 1164
    public function getSuffix()
437
    {
438 1164
        return $this->getOptionValue(self::SUFFIX);
439
    }
440
    /**
441
     * Set current suffix option value
442
     * @throws \InvalidArgumentException
443
     * @param string $suffix
444
     * @return GeneratorOptions
445
     */
446 78
    public function setSuffix($suffix)
447
    {
448 78
        return $this->setOptionValue(self::SUFFIX, $suffix);
449
    }
450
    /**
451
     * Get basic login option value
452
     * @return string
453
     */
454 1074
    public function getBasicLogin()
455
    {
456 1074
        return $this->getOptionValue(self::BASIC_LOGIN);
457
    }
458
    /**
459
     * Set current basic login option value
460
     * @throws \InvalidArgumentException
461
     * @param string $basicLogin
462
     * @return GeneratorOptions
463
     */
464 42
    public function setBasicLogin($basicLogin)
465
    {
466 42
        return $this->setOptionValue(self::BASIC_LOGIN, $basicLogin);
467
    }
468
    /**
469
     * Get basic password option value
470
     * @return string
471
     */
472 1074
    public function getBasicPassword()
473
    {
474 1074
        return $this->getOptionValue(self::BASIC_PASSWORD);
475
    }
476
    /**
477
     * Set current basic password option value
478
     * @throws \InvalidArgumentException
479
     * @param string $basicPassword
480
     * @return GeneratorOptions
481
     */
482 42
    public function setBasicPassword($basicPassword)
483
    {
484 42
        return $this->setOptionValue(self::BASIC_PASSWORD, $basicPassword);
485
    }
486
    /**
487
     * Get basic proxy host option value
488
     * @return string
489
     */
490 1074
    public function getProxyHost()
491
    {
492 1074
        return $this->getOptionValue(self::PROXY_HOST);
493
    }
494
    /**
495
     * Set current proxy host option value
496
     * @throws \InvalidArgumentException
497
     * @param string $proxyHost
498
     * @return GeneratorOptions
499
     */
500 42
    public function setProxyHost($proxyHost)
501
    {
502 42
        return $this->setOptionValue(self::PROXY_HOST, $proxyHost);
503
    }
504
    /**
505
     * Get basic proxy port option value
506
     * @return string
507
     */
508 1074
    public function getProxyPort()
509
    {
510 1074
        return $this->getOptionValue(self::PROXY_PORT);
511
    }
512
    /**
513
     * Set current proxy port option value
514
     * @throws \InvalidArgumentException
515
     * @param string $proxyPort
516
     * @return GeneratorOptions
517
     */
518 42
    public function setProxyPort($proxyPort)
519
    {
520 42
        return $this->setOptionValue(self::PROXY_PORT, $proxyPort);
521
    }
522
    /**
523
     * Get basic proxy login option value
524
     * @return string
525
     */
526 1074
    public function getProxyLogin()
527
    {
528 1074
        return $this->getOptionValue(self::PROXY_LOGIN);
529
    }
530
    /**
531
     * Set current proxy login option value
532
     * @throws \InvalidArgumentException
533
     * @param string $proxyLogin
534
     * @return GeneratorOptions
535
     */
536 42
    public function setProxyLogin($proxyLogin)
537
    {
538 42
        return $this->setOptionValue(self::PROXY_LOGIN, $proxyLogin);
539
    }
540
    /**
541
     * Get basic proxy password option value
542
     * @return string
543
     */
544 1074
    public function getProxyPassword()
545
    {
546 1074
        return $this->getOptionValue(self::PROXY_PASSWORD);
547
    }
548
    /**
549
     * Set current proxy password option value
550
     * @throws \InvalidArgumentException
551
     * @param string $proxyPassword
552
     * @return GeneratorOptions
553
     */
554 42
    public function setProxyPassword($proxyPassword)
555
    {
556 42
        return $this->setOptionValue(self::PROXY_PASSWORD, $proxyPassword);
557
    }
558
    /**
559
     * Get basic soap options option value
560
     * @return array
561
     */
562 1062
    public function getSoapOptions()
563
    {
564 1062
        return $this->getOptionValue(self::SOAP_OPTIONS);
565
    }
566
    /**
567
     * Set current soap options option value
568
     * @throws \InvalidArgumentException
569
     * @param array $soapOptions
570
     * @return GeneratorOptions
571
     */
572 48
    public function setSoapOptions(array $soapOptions)
573
    {
574 48
        return $this->setOptionValue(self::SOAP_OPTIONS, $soapOptions);
575
    }
576
    /**
577
     * Get composer name option value
578
     * @return string
579
     */
580 90
    public function getComposerName()
581
    {
582 90
        return $this->getOptionValue(self::COMPOSER_NAME);
583
    }
584
    /**
585
     * Set current composer name option value
586
     * @throws \InvalidArgumentException
587
     * @param string $composerName
588
     * @return GeneratorOptions
589
     */
590 126
    public function setComposerName($composerName)
591
    {
592 126
        return $this->setOptionValue(self::COMPOSER_NAME, $composerName);
593
    }
594
    /**
595
     * Get composer settings option value
596
     * @return array
597
     */
598 72
    public function getComposerSettings()
599
    {
600 72
        return $this->getOptionValue(self::COMPOSER_SETTINGS);
601
    }
602
    /**
603
     * Set current composer settings option value
604
     * @throws \InvalidArgumentException
605
     * @param array $composerSettings
606
     * @return GeneratorOptions
607
     */
608 108
    public function setComposerSettings(array $composerSettings = [])
609
    {
610
        /**
611
         * If array is type array("config.value:true","require:library/src",)
612
         */
613 108
        $settings = [];
614 108
        foreach ($composerSettings as $index => $value) {
615 42
            if (is_numeric($index) && mb_strpos($value, ':') > 0) {
616 42
                $path = implode('', array_slice(explode(':', $value), 0, 1));
617 42
                $val = implode(':', array_slice(explode(':', $value), 1));
618 42
                self::dotNotationToArray($path, $val, $settings);
619 21
            } else {
620 18
                $settings[$index] = $value;
621
            }
622 54
        }
623 108
        return $this->setOptionValue(self::COMPOSER_SETTINGS, $settings);
624
    }
625
    /**
626
     * turns my.key.path to array('my' => array('key' => array('path' => $value)))
627
     * @param string $string
628
     * @param mixed $value
629
     * @param array $array
630
     */
631 42
    protected static function dotNotationToArray($string, $value, array &$array)
632
    {
633 42
        $keys = explode('.', $string);
634 42
        foreach ($keys as $key) {
635 42
            $array = &$array[$key];
636 21
        }
637 42
        $array = ($value === 'true' || $value === 'false') ? $value === 'true' : $value;
638 42
    }
639
    /**
640
     * Get structs folder option value
641
     * @return string
642
     */
643 648
    public function getStructsFolder()
644
    {
645 648
        return $this->getOptionValue(self::STRUCTS_FOLDER);
646
    }
647
    /**
648
     * Set current structs folder option value
649
     * @throws \InvalidArgumentException
650
     * @param string $structsFolder
651
     * @return GeneratorOptions
652
     */
653 42
    public function setStructsFolder($structsFolder)
654
    {
655 42
        return $this->setOptionValue(self::STRUCTS_FOLDER, $structsFolder);
656
    }
657
    /**
658
     * Get arrays folder option value
659
     * @return string
660
     */
661 108
    public function getArraysFolder()
662
    {
663 108
        return $this->getOptionValue(self::ARRAYS_FOLDER);
664
    }
665
    /**
666
     * Set current arrays folder option value
667
     * @throws \InvalidArgumentException
668
     * @param string $arraysFolder
669
     * @return GeneratorOptions
670
     */
671 42
    public function setArraysFolder($arraysFolder)
672
    {
673 42
        return $this->setOptionValue(self::ARRAYS_FOLDER, $arraysFolder);
674
    }
675
    /**
676
     * Get enums folder option value
677
     * @return string
678
     */
679 234
    public function getEnumsFolder()
680
    {
681 234
        return $this->getOptionValue(self::ENUMS_FOLDER);
682
    }
683
    /**
684
     * Set current enums folder option value
685
     * @throws \InvalidArgumentException
686
     * @param string $enumsFolder
687
     * @return GeneratorOptions
688
     */
689 42
    public function setEnumsFolder($enumsFolder)
690
    {
691 42
        return $this->setOptionValue(self::ENUMS_FOLDER, $enumsFolder);
692
    }
693
    /**
694
     * Get services folder option value
695
     * @return string
696
     */
697 1014
    public function getServicesFolder()
698
    {
699 1014
        return $this->getOptionValue(self::SERVICES_FOLDER);
700
    }
701
    /**
702
     * Set current services folder option value
703
     * @throws \InvalidArgumentException
704
     * @param string $servicesFolder
705
     * @return GeneratorOptions
706
     */
707 42
    public function setServicesFolder($servicesFolder)
708
    {
709 42
        return $this->setOptionValue(self::SERVICES_FOLDER, $servicesFolder);
710
    }
711
    /**
712
     * Get schemas save option value
713
     * @return bool
714
     */
715 24
    public function getSchemasSave()
716
    {
717 24
        return $this->getOptionValue(self::SCHEMAS_SAVE);
718
    }
719
    /**
720
     * Set schemas save option value
721
     * @throws \InvalidArgumentException
722
     * @param bool $saveSchemas
723
     * @return GeneratorOptions
724
     */
725 48
    public function setSchemasSave($saveSchemas)
726
    {
727 48
        return $this->setOptionValue(self::SCHEMAS_SAVE, $saveSchemas);
728
    }
729
    /**
730
     * Get schemas folder option value
731
     * @return string
732
     */
733 18
    public function getSchemasFolder()
734
    {
735 18
        return $this->getOptionValue(self::SCHEMAS_FOLDER);
736
    }
737
    /**
738
     * Set schemas folder option value
739
     * @throws \InvalidArgumentException
740
     * @param string $schemasFolder
741
     * @return GeneratorOptions
742
     */
743 48
    public function setSchemasFolder($schemasFolder)
744
    {
745 48
        return $this->setOptionValue(self::SCHEMAS_FOLDER, $schemasFolder);
746
    }
747
    /**
748
     * Get xsd types path option value
749
     * @return string
750
     */
751 336
    public function getXsdTypesPath()
752
    {
753 336
        return $this->getOptionValue(self::XSD_TYPES_PATH);
754
    }
755
    /**
756
     * Set xsd types path option value
757
     * @throws \InvalidArgumentException
758
     * @param string $xsdTypesPath
759
     * @return GeneratorOptions
760
     */
761 6
    public function setXsdTypesPath($xsdTypesPath)
762
    {
763 6
        return $this->setOptionValue(self::XSD_TYPES_PATH, $xsdTypesPath);
764
    }
765
    /**
766
     * @return string[]
767
     */
768 54
    public function toArray()
769
    {
770 54
        $options = [];
771 54
        foreach (array_keys($this->options) as $name) {
772 54
            $options[$name] = $this->getOptionValue($name);
773 27
        }
774 54
        return $options;
775
    }
776 12
    public function jsonSerialize()
777
    {
778 12
        return $this->toArray();
779
    }
780
}
781