Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
14 / 14
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
AbstractAttributesParser
100.00% covered (success)
100.00%
14 / 14
100.00% covered (success)
100.00%
2 / 2
9
100.00% covered (success)
100.00%
1 / 1
 parseTag
100.00% covered (success)
100.00%
12 / 12
100.00% covered (success)
100.00%
1 / 1
7
 parseWsdl
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3declare(strict_types=1);
4
5namespace WsdlToPhp\PackageGenerator\Parser\Wsdl;
6
7use WsdlToPhp\PackageGenerator\Model\Struct;
8use WsdlToPhp\PackageGenerator\Model\StructAttribute;
9use WsdlToPhp\PackageGenerator\Model\Wsdl;
10use WsdlToPhp\WsdlHandler\Tag\AbstractTag as Tag;
11
12abstract class AbstractAttributesParser extends AbstractTagParser
13{
14    public function parseTag(Tag $tag): void
15    {
16        $parent = $tag->getSuitableParent();
17
18        if ($parent instanceof Tag) {
19            $model = $this->getModel($parent);
20            if ($model instanceof Struct) {
21                if ($tag->hasAttributeName() && ($modelAttribute = $model->getAttribute($tag->getAttributeName())) instanceof StructAttribute) {
22                    $this->parseTagAttributes($tag, $model, $modelAttribute);
23
24                    return;
25                }
26
27                if ($tag->hasAttributeRef() && ($modelAttribute = $model->getAttribute($tag->getAttributeRef())) instanceof StructAttribute) {
28                    $this->parseTagAttributes($tag, $model, $modelAttribute);
29
30                    return;
31                }
32
33                $this->parseTagAttributes($tag, $model);
34            }
35        }
36
37        $this->parseTagAttributes($tag);
38    }
39
40    protected function parseWsdl(Wsdl $wsdl): void
41    {
42        foreach ($this->getTags() as $tag) {
43            $this->parseTag($tag);
44        }
45    }
46}