Completed
Push — develop ( 63df75...505115 )
by Mikaël
657:18 queued 654:48
created

Generator::getOptionComposerName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace WsdlToPhp\PackageGenerator\Generator;
4
5
use WsdlToPhp\PackageGenerator\Model\Schema;
6
use WsdlToPhp\PackageGenerator\Model\Wsdl;
7
use WsdlToPhp\PackageGenerator\Model\AbstractModel;
8
use WsdlToPhp\PackageGenerator\Model\EmptyModel;
9
use WsdlToPhp\PackageGenerator\Model\Struct;
10
use WsdlToPhp\PackageGenerator\Model\Service;
11
use WsdlToPhp\PackageGenerator\Model\Method;
12
use WsdlToPhp\PackageGenerator\Container\Model\Service as ServiceContainer;
13
use WsdlToPhp\PackageGenerator\Container\Model\Struct as StructContainer;
14
use WsdlToPhp\PackageGenerator\ConfigurationReader\GeneratorOptions;
15
use WsdlToPhp\PackageGenerator\WsdlHandler\Wsdl as WsdlDocument;
16
17
class Generator
18
{
19
    /**
20
     * Wsdl
21
     * @var Wsdl
22
     */
23
    private $wsdl;
24
    /**
25
     * @var GeneratorOptions
26
     */
27
    private $options;
28
    /**
29
     * Used parsers
30
     * @var GeneratorParsers
31
     */
32
    private $parsers;
33
    /**
34
     * Used files
35
     * @var GeneratorFiles
36
     */
37
    private $files;
38
    /**
39
     * Used containers
40
     * @var GeneratorContainers
41
     */
42
    private $containers;
43
    /**
44
     * Used SoapClient
45
     * @var GeneratorSoapClient
46
     */
47
    private $soapClient;
48
    /**
49
     * Constructor
50
     * @param GeneratorOptions $options
51
     */
52 828
    public function __construct(GeneratorOptions $options)
53
    {
54 828
        $this->setOptions($options)->initialize();
55 816
    }
56
    /**
57
     * @return Generator
58
     */
59 828
    protected function initialize()
60
    {
61 828
        return $this->initContainers()
62 828
            ->initParsers()
63 828
            ->initFiles()
64 828
            ->initSoapClient()
65 822
            ->initWsdl();
66
    }
67
    /**
68
     * @throws \InvalidArgumentException
69
     * @return Generator
70
     */
71 828
    protected function initSoapClient()
72
    {
73 828
        if (!isset($this->soapClient)) {
74 828
            $this->soapClient = new GeneratorSoapClient($this);
75 548
        }
76 822
        return $this;
77
    }
78
    /**
79
     * @return Generator
80
     */
81 828
    protected function initContainers()
82
    {
83 828
        if (!isset($this->containers)) {
84 828
            $this->containers = new GeneratorContainers($this);
85 552
        }
86 828
        return $this;
87
    }
88
    /**
89
     * @return Generator
90
     */
91 828
    protected function initParsers()
92
    {
93 828
        if (!isset($this->parsers)) {
94 828
            $this->parsers = new GeneratorParsers($this);
95 552
        }
96 828
        return $this;
97
    }
98
    /**
99
     * @return GeneratorParsers
100
     */
101 288
    public function getParsers()
102
    {
103 288
        return $this->parsers;
104
    }
105
    /**
106
     * @return Generator
107
     */
108 828
    protected function initFiles()
109
    {
110 828
        if (!isset($this->files)) {
111 828
            $this->files = new GeneratorFiles($this);
112 552
        }
113 828
        return $this;
114
    }
115
    /**
116
     * @return GeneratorFiles
117
     */
118 72
    public function getFiles()
119
    {
120 72
        return $this->files;
121
    }
122
    /**
123
     * @throws \InvalidArgumentException
124
     * @return Generator
125
     */
126 42
    protected function initDirectory()
127
    {
128 42
        Utils::createDirectory($this->getOptions()->getDestination());
129 42
        if (!is_writable($this->getOptionDestination())) {
130 6
            throw new \InvalidArgumentException(sprintf('Unable to use dir "%s" as dir does not exists, its creation has been impossible or it\'s not writable', $this->getOptionDestination()), __LINE__);
131
        }
132 36
        return $this;
133
    }
134
    /**
135
     * @return Generator
136
     */
137 828
    protected function initWsdl()
138
    {
139 828
        $this->setWsdl(new Wsdl($this, $this->getOptionOrigin(), $this->getUrlContent($this->getOptionOrigin())));
140 822
        return $this;
141
    }
142
    /**
143
     * @return Generator
144
     */
145 54
    protected function doSanityChecks()
146
    {
147 54
        $destination = $this->getOptionDestination();
148 54
        if (empty($destination)) {
149 6
            throw new \InvalidArgumentException('Package\'s destination must be defined', __LINE__);
150
        }
151 48
        $composerName = $this->getOptionComposerName();
152 48
        if ($this->getOptionStandalone() && empty($composerName)) {
153 6
            throw new \InvalidArgumentException('Package\'s composer name must be defined', __LINE__);
154
        }
155 42
        return $this;
156
    }
157
    /**
158
     * @return Generator
159
     */
160 36
    protected function doParse()
161
    {
162 36
        $this->parsers->doParse();
163 36
        return $this;
164
    }
165
    /**
166
     * @return Generator
167
     */
168 36
    protected function doGenerate()
169
    {
170 36
        $this->files->doGenerate();
171 36
        return $this;
172
    }
173
    /**
174
     * Generates all classes based on options
175
     * @return Generator
176
     */
177 54
    public function generatePackage()
178
    {
179 54
        return $this->doSanityChecks()->initDirectory()->doParse()->doGenerate();
180
    }
181
    /**
182
     * Gets the struct by its name
183
     * @uses Generator::getStructs()
184
     * @param string $structName the original struct name
185
     * @return Struct|null
186
     */
187 606
    public function getStruct($structName)
188
    {
189 606
        return $this->getStructs()->getStructByName($structName);
190
    }
191
    /**
192
     * Gets a service by its name
193
     * @param string $serviceName the service name
194
     * @return Service|null
195
     */
196 528
    public function getService($serviceName)
197
    {
198 528
        return $this->getServices()->getServiceByName($serviceName);
199
    }
200
    /**
201
     * Returns the method
202
     * @uses Generator::getServiceName()
203
     * @uses Generator::getService()
204
     * @uses Service::getMethod()
205
     * @param string $methodName the original function name
206
     * @return Method|null
207
     */
208 522
    public function getServiceMethod($methodName)
209
    {
210 522
        return $this->getService($this->getServiceName($methodName)) instanceof Service ? $this->getService($this->getServiceName($methodName))->getMethod($methodName) : null;
211
    }
212
    /**
213
     * @return ServiceContainer
214
     */
215 738
    public function getServices()
216
    {
217 738
        return $this->containers->getServices();
218
    }
219
    /**
220
     * @return StructContainer
221
     */
222 714
    public function getStructs()
223
    {
224 714
        return $this->containers->getStructs();
225
    }
226
    /**
227
     * Sets the optionCategory value
228
     * @return string
229
     */
230 462
    public function getOptionCategory()
231
    {
232 462
        return $this->options->getCategory();
233
    }
234
    /**
235
     * Sets the optionCategory value
236
     * @param string $category
237
     * @return Generator
238
     */
239 432
    public function setOptionCategory($category)
240
    {
241 432
        $this->options->setCategory($category);
242 432
        return $this;
243
    }
244
    /**
245
     * Sets the optionGatherMethods value
246
     * @return string
247
     */
248 750
    public function getOptionGatherMethods()
249
    {
250 750
        return $this->options->getGatherMethods();
251
    }
252
    /**
253
     * Sets the optionGatherMethods value
254
     * @param string $gatherMethods
255
     * @return Generator
256
     */
257 432
    public function setOptionGatherMethods($gatherMethods)
258
    {
259 432
        $this->options->setGatherMethods($gatherMethods);
260 432
        return $this;
261
    }
262
    /**
263
     * Gets the optionGenericConstantsNames value
264
     * @return bool
265
     */
266 96
    public function getOptionGenericConstantsNames()
267
    {
268 96
        return $this->options->getGenericConstantsName();
269
    }
270
    /**
271
     * Sets the optionGenericConstantsNames value
272
     * @param bool $genericConstantsNames
273
     * @return Generator
274
     */
275 12
    public function setOptionGenericConstantsNames($genericConstantsNames)
276
    {
277 12
        $this->options->setGenericConstantsName($genericConstantsNames);
278 12
        return $this;
279
    }
280
    /**
281
     * Gets the optionGenerateTutorialFile value
282
     * @return bool
283
     */
284 48
    public function getOptionGenerateTutorialFile()
285
    {
286 48
        return $this->options->getGenerateTutorialFile();
287
    }
288
    /**
289
     * Sets the optionGenerateTutorialFile value
290
     * @param bool $generateTutorialFile
291
     * @return Generator
292
     */
293 6
    public function setOptionGenerateTutorialFile($generateTutorialFile)
294
    {
295 6
        $this->options->setGenerateTutorialFile($generateTutorialFile);
296 6
        return $this;
297
    }
298
    /**
299
     * Gets the optionNamespacePrefix value
300
     * @return string
301
     */
302 426
    public function getOptionNamespacePrefix()
303
    {
304 426
        return $this->options->getNamespace();
305
    }
306
    /**
307
     * Sets the optionGenerateTutorialFile value
308
     * @param string $namespace
309
     * @return Generator
310
     */
311 30
    public function setOptionNamespacePrefix($namespace)
312
    {
313 30
        $this->options->setNamespace($namespace);
314 30
        return $this;
315
    }
316
    /**
317
     * Gets the optionAddComments value
318
     * @return array
319
     */
320 336
    public function getOptionAddComments()
321
    {
322 336
        return $this->options->getAddComments();
323
    }
324
    /**
325
     * Sets the optionAddComments value
326
     * @param array $addComments
327
     * @return Generator
328
     */
329 432
    public function setOptionAddComments($addComments)
330
    {
331 432
        $this->options->setAddComments($addComments);
332 432
        return $this;
333
    }
334
    /**
335
     * Gets the optionStandalone value
336
     * @return bool
337
     */
338 96
    public function getOptionStandalone()
339
    {
340 96
        return $this->options->getStandalone();
341
    }
342
    /**
343
     * Sets the optionStandalone value
344
     * @param bool $standalone
345
     * @return Generator
346
     */
347 12
    public function setOptionStandalone($standalone)
348
    {
349 12
        $this->options->setStandalone($standalone);
350 12
        return $this;
351
    }
352
    /**
353
     * Gets the optionValidation value
354
     * @return bool
355
     */
356 198
    public function getOptionValidation()
357
    {
358 198
        return $this->options->getValidation();
359
    }
360
    /**
361
     * Sets the optionValidation value
362
     * @param bool $validation
363
     * @return Generator
364
     */
365 42
    public function setOptionValidation($validation)
366
    {
367 42
        $this->options->setValidation($validation);
368 42
        return $this;
369
    }
370
    /**
371
     * Gets the optionStructClass value
372
     * @return string
373
     */
374 168
    public function getOptionStructClass()
375
    {
376 168
        return $this->options->getStructClass();
377
    }
378
    /**
379
     * Sets the optionStructClass value
380
     * @param string $structClass
381
     * @return Generator
382
     */
383 18
    public function setOptionStructClass($structClass)
384
    {
385 18
        $this->options->setStructClass($structClass);
386 18
        return $this;
387
    }
388
    /**
389
     * Gets the optionStructArrayClass value
390
     * @return string
391
     */
392 60
    public function getOptionStructArrayClass()
393
    {
394 60
        return $this->options->getStructArrayClass();
395
    }
396
    /**
397
     * Sets the optionStructArrayClass value
398
     * @param string $structArrayClass
399
     * @return Generator
400
     */
401 6
    public function setOptionStructArrayClass($structArrayClass)
402
    {
403 6
        $this->options->setStructArrayClass($structArrayClass);
404 6
        return $this;
405
    }
406
    /**
407
     * Gets the optionSoapClientClass value
408
     * @return string
409
     */
410 144
    public function getOptionSoapClientClass()
411
    {
412 144
        return $this->options->getSoapClientClass();
413
    }
414
    /**
415
     * Sets the optionSoapClientClass value
416
     * @param string $soapClientClass
417
     * @return Generator
418
     */
419 6
    public function setOptionSoapClientClass($soapClientClass)
420
    {
421 6
        $this->options->setSoapClientClass($soapClientClass);
422 6
        return $this;
423
    }
424
    /**
425
     * Gets the package name prefix
426
     * @param bool $ucFirst ucfirst package name prefix or not
427
     * @return string
428
     */
429 864
    public function getOptionPrefix($ucFirst = true)
430
    {
431 864
        return $ucFirst ? ucfirst($this->getOptions()->getPrefix()) : $this->getOptions()->getPrefix();
432
    }
433
    /**
434
     * Sets the package name prefix
435
     * @param string $optionPrefix
436
     * @return Generator
437
     */
438 480
    public function setOptionPrefix($optionPrefix)
439
    {
440 480
        $this->options->setPrefix($optionPrefix);
441 480
        return $this;
442
    }
443
    /**
444
     * Gets the package name suffix
445
     * @param bool $ucFirst ucfirst package name suffix or not
446
     * @return string
447
     */
448 828
    public function getOptionSuffix($ucFirst = true)
449
    {
450 828
        return $ucFirst ? ucfirst($this->getOptions()->getSuffix()) : $this->getOptions()->getSuffix();
451
    }
452
    /**
453
     * Sets the package name suffix
454
     * @param string $optionSuffix
455
     * @return Generator
456
     */
457 42
    public function setOptionSuffix($optionSuffix)
458
    {
459 42
        $this->options->setSuffix($optionSuffix);
460 42
        return $this;
461
    }
462
    /**
463
     * Gets the optionBasicLogin value
464
     * @return string
465
     */
466 852
    public function getOptionBasicLogin()
467
    {
468 852
        return $this->options->getBasicLogin();
469
    }
470
    /**
471
     * Sets the optionBasicLogin value
472
     * @param string $optionBasicLogin
473
     * @return Generator
474
     */
475 6
    public function setOptionBasicLogin($optionBasicLogin)
476
    {
477 6
        $this->options->setBasicLogin($optionBasicLogin);
478 6
        return $this;
479
    }
480
    /**
481
     * Gets the optionBasicPassword value
482
     * @return string
483
     */
484 852
    public function getOptionBasicPassword()
485
    {
486 852
        return $this->options->getBasicPassword();
487
    }
488
    /**
489
     * Sets the optionBasicPassword value
490
     * @param string $optionBasicPassword
491
     * @return Generator
492
     */
493 6
    public function setOptionBasicPassword($optionBasicPassword)
494
    {
495 6
        $this->options->setBasicPassword($optionBasicPassword);
496 6
        return $this;
497
    }
498
    /**
499
     * Gets the optionProxyHost value
500
     * @return string
501
     */
502 852
    public function getOptionProxyHost()
503
    {
504 852
        return $this->options->getProxyHost();
505
    }
506
    /**
507
     * Sets the optionProxyHost value
508
     * @param string $optionProxyHost
509
     * @return Generator
510
     */
511 6
    public function setOptionProxyHost($optionProxyHost)
512
    {
513 6
        $this->options->setProxyHost($optionProxyHost);
514 6
        return $this;
515
    }
516
    /**
517
     * Gets the optionProxyPort value
518
     * @return string
519
     */
520 852
    public function getOptionProxyPort()
521
    {
522 852
        return $this->options->getProxyPort();
523
    }
524
    /**
525
     * Sets the optionProxyPort value
526
     * @param string $optionProxyPort
527
     * @return Generator
528
     */
529 6
    public function setOptionProxyPort($optionProxyPort)
530
    {
531 6
        $this->options->setProxyPort($optionProxyPort);
532 6
        return $this;
533
    }
534
    /**
535
     * Gets the optionProxyLogin value
536
     * @return string
537
     */
538 852
    public function getOptionProxyLogin()
539
    {
540 852
        return $this->options->getProxyLogin();
541
    }
542
    /**
543
     * Sets the optionProxyLogin value
544
     * @param string $optionProxyLogin
545
     * @return Generator
546
     */
547 6
    public function setOptionProxyLogin($optionProxyLogin)
548
    {
549 6
        $this->options->setProxyLogin($optionProxyLogin);
550 6
        return $this;
551
    }
552
    /**
553
     * Gets the optionProxyPassword value
554
     * @return string
555
     */
556 852
    public function getOptionProxyPassword()
557
    {
558 852
        return $this->options->getProxyPassword();
559
    }
560
    /**
561
     * Sets the optionProxyPassword value
562
     * @param string $optionProxyPassword
563
     * @return Generator
564
     */
565 6
    public function setOptionProxyPassword($optionProxyPassword)
566
    {
567 6
        $this->options->setProxyPassword($optionProxyPassword);
568 6
        return $this;
569
    }
570
    /**
571
     * Gets the optionOrigin value
572
     * @return string
573
     */
574 846
    public function getOptionOrigin()
575
    {
576 846
        return $this->options->getOrigin();
577
    }
578
    /**
579
     * Sets the optionOrigin value
580
     * @param string $optionOrigin
581
     * @return Generator
582
     */
583 6
    public function setOptionOrigin($optionOrigin)
584
    {
585 6
        $this->options->setOrigin($optionOrigin);
586 6
        $this->initWsdl();
587 6
        return $this;
588
    }
589
    /**
590
     * Gets the optionDestination value
591
     * @return string
592
     */
593 486
    public function getOptionDestination()
594
    {
595 486
        $destination = $this->options->getDestination();
596 486
        if (!empty($destination)) {
597 480
            $destination = realpath($this->options->getDestination()) . DIRECTORY_SEPARATOR;
598 320
        }
599 486
        return $destination;
600
    }
601
    /**
602
     * Sets the optionDestination value
603
     * @param string $optionDestination
604
     * @return Generator
605
     */
606 18
    public function setOptionDestination($optionDestination)
607
    {
608 18
        if (!empty($optionDestination)) {
609 12
            $this->options->setDestination(realpath($optionDestination) . DIRECTORY_SEPARATOR);
610 8
        } else {
611 6
            throw new \InvalidArgumentException('Package\'s destination can\'t be empty', __LINE__);
612
        }
613 12
        return $this;
614
    }
615
    /**
616
     * Gets the optionSrcDiname value
617
     * @return string
618
     */
619 426
    public function getOptionSrcDirname()
620
    {
621 426
        return $this->options->getSrcDirname();
622
    }
623
    /**
624
     * Sets the optionSrcDirname value
625
     * @param string $optionSrcDirname
626
     * @return Generator
627
     */
628 18
    public function setOptionSrcDirname($optionSrcDirname)
629
    {
630 18
        $this->options->setSrcDirname($optionSrcDirname);
631 18
        return $this;
632
    }
633
    /**
634
     * Gets the optionSoapOptions value
635
     * @return string
636
     */
637 840
    public function getOptionSoapOptions()
638
    {
639 840
        return $this->options->getSoapOptions();
640
    }
641
    /**
642
     * Sets the optionSoapOptions value
643
     * @param array $optionSoapOptions
644
     * @return Generator
645
     */
646 6
    public function setOptionSoapOptions($optionSoapOptions)
647
    {
648 6
        $this->options->setSoapOptions($optionSoapOptions);
649 6
        if ($this->getSoapClient() instanceof GeneratorSoapClient) {
650 6
            $this->getSoapClient()->initSoapClient();
651 4
        }
652 6
        return $this;
653
    }
654
    /**
655
     * Gets the optionComposerName value
656
     * @return string
657
     */
658 78
    public function getOptionComposerName()
659
    {
660 78
        return $this->options->getComposerName();
661
    }
662
    /**
663
     * Sets the optionComposerName value
664
     * @param string $optionComposerName
665
     * @return Generator
666
     */
667 42
    public function setOptionComposerName($optionComposerName)
668
    {
669 42
        if (!empty($optionComposerName)) {
670 36
            $this->options->setComposerName($optionComposerName);
671 24
        } else {
672 6
            throw new \InvalidArgumentException('Package\'s composer name can\'t be empty', __LINE__);
673
        }
674 36
        return $this;
675
    }
676
    /**
677
     * Gets the optionComposerSettings value
678
     * @return array
679
     */
680 60
    public function getOptionComposerSettings()
681
    {
682 60
        return $this->options->getComposerSettings();
683
    }
684
    /**
685
     * Sets the optionComposerSettings value
686
     * @param array $optionComposerSettings
687
     * @return Generator
688
     */
689 12
    public function setOptionComposerSettings(array $optionComposerSettings = array())
690
    {
691 12
        $this->options->setComposerSettings($optionComposerSettings);
692 12
        return $this;
693
    }
694
    /**
695
     * Gets the optionStructsFolder value
696
     * @return string
697
     */
698 420
    public function getOptionStructsFolder()
699
    {
700 420
        return $this->options->getStructsFolder();
701
    }
702
    /**
703
     * Sets the optionStructsFolder value
704
     * @param string $optionStructsFolder
705
     * @return Generator
706
     */
707 6
    public function setOptionStructsFolder($optionStructsFolder)
708
    {
709 6
        $this->options->setStructsFolder($optionStructsFolder);
710 6
        return $this;
711
    }
712
    /**
713
     * Gets the optionArraysFolder value
714
     * @return string
715
     */
716 84
    public function getOptionArraysFolder()
717
    {
718 84
        return $this->options->getArraysFolder();
719
    }
720
    /**
721
     * Sets the optionArraysFolder value
722
     * @param string $optionArraysFolder
723
     * @return Generator
724
     */
725 6
    public function setOptionArraysFolder($optionArraysFolder)
726
    {
727 6
        $this->options->setArraysFolder($optionArraysFolder);
728 6
        return $this;
729
    }
730
    /**
731
     * Gets the optionEnumsFolder value
732
     * @return string
733
     */
734 162
    public function getOptionEnumsFolder()
735
    {
736 162
        return $this->options->getEnumsFolder();
737
    }
738
    /**
739
     * Sets the optionEnumsFolder value
740
     * @param string $optionEnumsFolder
741
     * @return Generator
742
     */
743 6
    public function setOptionEnumsFolder($optionEnumsFolder)
744
    {
745 6
        $this->options->setEnumsFolder($optionEnumsFolder);
746 6
        return $this;
747
    }
748
    /**
749
     * Gets the optionServicesFolder value
750
     * @return string
751
     */
752 804
    public function getOptionServicesFolder()
753
    {
754 804
        return $this->options->getServicesFolder();
755
    }
756
    /**
757
     * Sets the optionServicesFolder value
758
     * @param string $optionServicesFolder
759
     * @return Generator
760
     */
761 6
    public function setOptionServicesFolder($optionServicesFolder)
762
    {
763 6
        $this->options->setServicesFolder($optionServicesFolder);
764 6
        return $this;
765
    }
766
    /**
767
     * Gets the WSDL
768
     * @return Wsdl|null
769
     */
770 738
    public function getWsdl()
771
    {
772 738
        return $this->wsdl;
773
    }
774
    /**
775
     * Sets the WSDLs
776
     * @param Wsdl $wsdl
777
     * @return Generator
778
     */
779 822
    protected function setWsdl(Wsdl $wsdl)
780
    {
781 822
        $this->wsdl = $wsdl;
782 822
        return $this;
783
    }
784
    /**
785
     * Adds Wsdl location
786
     * @param Wsdl $wsdl
787
     * @param string $schemaLocation
788
     * @return Generator
789
     */
790 288
    public function addSchemaToWsdl(Wsdl $wsdl, $schemaLocation)
791
    {
792 288
        if (!empty($schemaLocation) && $wsdl->getContent() instanceof WsdlDocument && $wsdl->getContent()->getExternalSchema($schemaLocation) === null) {
793 282
            $wsdl->getContent()->addExternalSchema(new Schema($wsdl->getGenerator(), $schemaLocation, $this->getUrlContent($schemaLocation)));
794 188
        }
795 288
        return $this;
796
    }
797
    /**
798
     * Gets gather name class
799
     * @param AbstractModel $model the model for which we generate the folder
800
     * @return string
801
     */
802 714
    private function getGather(AbstractModel $model)
803
    {
804 714
        return Utils::getPart($this->getOptionGatherMethods(), $model->getCleanName());
805
    }
806
    /**
807
     * Returns the service name associated to the method/operation name in order to gather them in one service class
808
     * @uses Generator::getGather()
809
     * @param string $methodName original operation/method name
810
     * @return string
811
     */
812 738
    public function getServiceName($methodName)
813
    {
814 738
        return ucfirst($this->getOptionGatherMethods() === GeneratorOptions::VALUE_NONE ? Service::DEFAULT_SERVICE_CLASS_NAME : $this->getGather(new EmptyModel($this, $methodName)));
815
    }
816
    /**
817
     * @param GeneratorOptions $options
818
     * @return Generator
819
     */
820 828
    protected function setOptions(GeneratorOptions $options = null)
821
    {
822 828
        $this->options = $options;
823 828
        return $this;
824
    }
825
    /**
826
     * @return GeneratorOptions
827
     */
828 882
    public function getOptions()
829
    {
830 882
        return $this->options;
831
    }
832
    /**
833
     * @return GeneratorSoapClient
834
     */
835 774
    public function getSoapClient()
836
    {
837 774
        return $this->soapClient;
838
    }
839
    /**
840
     * @param string $url
841
     * @return string
842
     */
843 834
    public function getUrlContent($url)
844
    {
845 834
        if (strpos($url, '://') !== false) {
846 12
            return Utils::getContentFromUrl($url, $this->getOptionBasicLogin(), $this->getOptionBasicPassword(), $this->getOptionProxyHost(), $this->getOptionProxyPort(), $this->getOptionProxyLogin(), $this->getOptionProxyPassword(), $this->getSoapClient()->getSoapClientStreamContextOptions());
847 822
        } elseif (is_file($url)) {
848 816
            return file_get_contents($url);
849
        }
850 6
        return null;
851
    }
852
}
853