Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
TagAttribute
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
2 / 2
7
100.00% covered (success)
100.00%
1 / 1
 parseTag
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
6
 parsingTag
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
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\WsdlHandler\Tag\AbstractTag as Tag;
10use WsdlToPhp\WsdlHandler\Tag\TagAttributeGroup;
11use WsdlToPhp\WsdlHandler\Wsdl as WsdlDocument;
12
13final class TagAttribute extends AbstractAttributesParser
14{
15    public function parseTag(Tag $tag): void
16    {
17        parent::parseTag($tag);
18
19        $parent = $tag->getSuitableParent();
20
21        // Is it part of an attributeGroup?
22        if (!$tag->hasAttribute('type') || !$parent instanceof TagAttributeGroup) {
23            return;
24        }
25
26        foreach ($parent->getReferencingElements() as $element) {
27            if (($model = $this->getModel($element)) instanceof Struct && ($attribute = $model->getAttribute($tag->getAttributeName())) instanceof StructAttribute) {
28                $this->parseTagAttributes($tag, $attribute);
29            }
30        }
31    }
32
33    protected function parsingTag(): string
34    {
35        return WsdlDocument::TAG_ATTRIBUTE;
36    }
37}