Completed
Push — develop ( 695f05...cce551 )
by Mikaël
98:14 queued 95:30
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 452
    public function __construct(Generator $generator)
33
    {
34 452
        parent::__construct($generator);
35 452
        $this->initParsers();
36 452
    }
37
    /**
38
     * @return GeneratorParsers
39
     */
40 452
    protected function initParsers()
41
    {
42 452
        if (!isset($this->parsers)) {
43 452
            $this->parsers = new ParserContainer($this->generator);
44 452
            $this->parsers
45 452
                ->add(new FunctionsParser($this->generator))
46 452
                ->add(new StructsParser($this->generator))
47 452
                ->add(new TagIncludeParser($this->generator))
48 452
                ->add(new TagImportParser($this->generator))
49 452
                ->add(new TagAttributeParser($this->generator))
50 452
                ->add(new TagComplexTypeParser($this->generator))
51 452
                ->add(new TagDocumentationParser($this->generator))
52 452
                ->add(new TagElementParser($this->generator))
53 452
                ->add(new TagEnumerationParser($this->generator))
54 452
                ->add(new TagExtensionParser($this->generator))
55 452
                ->add(new TagHeaderParser($this->generator))
56 452
                ->add(new TagInputParser($this->generator))
57 452
                ->add(new TagOutputParser($this->generator))
58 452
                ->add(new TagRestrictionParser($this->generator))
59 452
                ->add(new TagUnionParser($this->generator))
60 452
                ->add(new TagListParser($this->generator));
61 452
        }
62 452
        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 20
        }
72 20
        return $this;
73
    }
74
    /**
75
     * @return ParserContainer
76
     */
77 148
    public function getParsers()
78
    {
79 148
        return $this->parsers;
80
    }
81
}
82