Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
90.00% covered (success)
90.00%
9 / 10
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
TagElement
90.00% covered (success)
90.00%
9 / 10
50.00% covered (danger)
50.00%
1 / 2
5.03
0.00% covered (danger)
0.00%
0 / 1
 parsingTag
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 parseTagAttributes
88.89% covered (warning)
88.89%
8 / 9
0.00% covered (danger)
0.00%
0 / 1
4.02
1<?php
2
3declare(strict_types=1);
4
5namespace WsdlToPhp\PackageGenerator\Parser\Wsdl;
6
7use WsdlToPhp\PackageGenerator\Model\AbstractModel;
8use WsdlToPhp\PackageGenerator\Model\StructAttribute;
9use WsdlToPhp\WsdlHandler\AbstractDocument;
10use WsdlToPhp\WsdlHandler\Tag\AbstractTag as Tag;
11use WsdlToPhp\WsdlHandler\Tag\TagSequence;
12use WsdlToPhp\WsdlHandler\Wsdl as WsdlDocument;
13
14final class TagElement extends AbstractAttributesParser
15{
16    protected function parsingTag(): string
17    {
18        return WsdlDocument::TAG_ELEMENT;
19    }
20
21    protected function parseTagAttributes(Tag $tag, AbstractModel $model = null, StructAttribute $structAttribute = null): void
22    {
23        parent::parseTagAttributes($tag, $model, $structAttribute);
24
25        if ($structAttribute instanceof StructAttribute) {
26            $structAttribute
27                ->setContainsElements($tag->canOccurSeveralTimes())
28                ->setRemovableFromRequest($tag->isRemovable())
29            ;
30
31            $sequence = $tag->getSuitableParent(false, [AbstractDocument::TAG_SEQUENCE]);
32            if ($sequence instanceof TagSequence && $sequence->canOccurSeveralTimes()) {
33                $structAttribute->setContainsElements();
34            }
35        }
36    }
37}