Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
28 / 28
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
GeneratorParsers
100.00% covered (success)
100.00%
28 / 28
100.00% covered (success)
100.00%
4 / 4
6
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 doParse
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
2
 getParsers
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 initParsers
100.00% covered (success)
100.00%
22 / 22
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3declare(strict_types=1);
4
5namespace WsdlToPhp\PackageGenerator\Generator;
6
7use WsdlToPhp\PackageGenerator\Container\Parser as ParserContainer;
8use WsdlToPhp\PackageGenerator\Parser\SoapClient\Functions as FunctionsParser;
9use WsdlToPhp\PackageGenerator\Parser\SoapClient\Structs as StructsParser;
10use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagAttribute as TagAttributeParser;
11use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagChoice as TagChoiceParser;
12use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagComplexType as TagComplexTypeParser;
13use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagDocumentation as TagDocumentationParser;
14use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagElement as TagElementParser;
15use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagEnumeration as TagEnumerationParser;
16use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagExtension as TagExtensionParser;
17use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagHeader as TagHeaderParser;
18use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagImport as TagImportParser;
19use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagInclude as TagIncludeParser;
20use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagInput as TagInputParser;
21use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagList as TagListParser;
22use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagOutput as TagOutputParser;
23use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagRestriction as TagRestrictionParser;
24use WsdlToPhp\PackageGenerator\Parser\Wsdl\TagUnion as TagUnionParser;
25
26class GeneratorParsers extends AbstractGeneratorAware
27{
28    protected ParserContainer $parsers;
29
30    public function __construct(Generator $generator)
31    {
32        parent::__construct($generator);
33        $this->initParsers();
34    }
35
36    public function doParse(): self
37    {
38        foreach ($this->parsers as $parser) {
39            $parser->parse();
40        }
41
42        return $this;
43    }
44
45    public function getParsers(): ParserContainer
46    {
47        return $this->parsers;
48    }
49
50    protected function initParsers(): self
51    {
52        if (!isset($this->parsers)) {
53            $this->parsers = new ParserContainer($this->generator);
54            $this->parsers
55                ->add(new FunctionsParser($this->generator))
56                ->add(new StructsParser($this->generator))
57                ->add(new TagIncludeParser($this->generator))
58                ->add(new TagImportParser($this->generator))
59                ->add(new TagEnumerationParser($this->generator))
60                ->add(new TagAttributeParser($this->generator))
61                ->add(new TagComplexTypeParser($this->generator))
62                ->add(new TagElementParser($this->generator))
63                ->add(new TagExtensionParser($this->generator))
64                ->add(new TagHeaderParser($this->generator))
65                ->add(new TagInputParser($this->generator))
66                ->add(new TagOutputParser($this->generator))
67                ->add(new TagRestrictionParser($this->generator))
68                ->add(new TagUnionParser($this->generator))
69                ->add(new TagListParser($this->generator))
70                ->add(new TagChoiceParser($this->generator))
71                ->add(new TagDocumentationParser($this->generator))
72            ;
73        }
74
75        return $this;
76    }
77}