Completed
Push — feature/issue-47 ( cdce8d...8413b2 )
by Mikaël
24:42
created

GeneratorParsers::getParsers()   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 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace WsdlToPhp\PackageGenerator\Generator;
4
5
use WsdlToPhp\PackageGenerator\Container\Parser as ParserContainer;
6
use WsdlToPhp\PackageGenerator\Parser\SoapClient\Structs as StructsParser;
7
use WsdlToPhp\PackageGenerator\Parser\SoapClient\Functions as FunctionsParser;
8
use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagAttribute as TagAttributeParser;
9
use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagComplexType as TagComplexTypeParser;
10
use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagDocumentation as TagDocumentationParser;
11
use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagElement as TagElementParser;
12
use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagEnumeration as TagEnumerationParser;
13
use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagExtension as TagExtensionParser;
14
use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagHeader as TagHeaderParser;
15
use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagImport as TagImportParser;
16
use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagInclude as TagIncludeParser;
17
use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagInput as TagInputParser;
18
use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagList as TagListParser;
19
use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagOutput as TagOutputParser;
20
use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagRestriction as TagRestrictionParser;
21
use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagUnion as TagUnionParser;
22
23
class GeneratorParsers extends AbstractGeneratorAware
24
{
25
    /**
26
     * @var ParserContainer
27
     */
28
    protected $parsers;
29
    /**
30
     * @param Generator $generator
31
     */
32 448
    public function __construct(Generator $generator)
33
    {
34 448
        parent::__construct($generator);
35 448
        $this->initParsers();
36 448
    }
37
    /**
38
     * @return GeneratorParsers
39
     */
40 448
    protected function initParsers()
41
    {
42 448
        if (!isset($this->parsers)) {
43 448
            $this->parsers = new ParserContainer($this->generator);
44 448
            $this->parsers
45 448
                ->add(new FunctionsParser($this->generator))
46 448
                ->add(new StructsParser($this->generator))
47 448
                ->add(new TagIncludeParser($this->generator))
48 448
                ->add(new TagImportParser($this->generator))
49 448
                ->add(new TagAttributeParser($this->generator))
50 448
                ->add(new TagComplexTypeParser($this->generator))
51 448
                ->add(new TagDocumentationParser($this->generator))
52 448
                ->add(new TagElementParser($this->generator))
53 448
                ->add(new TagEnumerationParser($this->generator))
54 448
                ->add(new TagExtensionParser($this->generator))
55 448
                ->add(new TagHeaderParser($this->generator))
56 448
                ->add(new TagInputParser($this->generator))
57 448
                ->add(new TagOutputParser($this->generator))
58 448
                ->add(new TagRestrictionParser($this->generator))
59 448
                ->add(new TagUnionParser($this->generator))
60 448
                ->add(new TagListParser($this->generator));
61 336
        }
62 448
        return $this;
63
    }
64
    /**
65
     * @return GeneratorParsers
66
     */
67 20
    public function doParse()
68
    {
69 20
        foreach ($this->parsers as $parser) {
70 20
            $parser->parse();
71 15
        }
72 20
        return $this;
73
    }
74
    /**
75
     * @return ParserContainer
76
     */
77 144
    public function getParsers()
78
    {
79 144
        return $this->parsers;
80
    }
81
}
82