Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
TagExtension
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
3 / 3
8
100.00% covered (success)
100.00%
1 / 1
 parseExtension
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
5
 parseWsdl
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
 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\AbstractModel;
8use WsdlToPhp\PackageGenerator\Model\Wsdl;
9use WsdlToPhp\WsdlHandler\Tag\AbstractTag;
10use WsdlToPhp\WsdlHandler\Tag\TagExtension as Extension;
11use WsdlToPhp\WsdlHandler\Wsdl as WsdlDocument;
12
13final class TagExtension extends AbstractTagParser
14{
15    public function parseExtension(Extension $extension): void
16    {
17        $base = $extension->getAttribute('base')->getValue();
18        $parent = $extension->getSuitableParent();
19        if (!empty($base) && $parent instanceof AbstractTag && $this->getModel($parent) instanceof AbstractModel && $parent->getAttributeName() !== $base) {
20            $this->getModel($parent)->setInheritance($base);
21        }
22    }
23
24    protected function parseWsdl(Wsdl $wsdl): void
25    {
26        foreach ($this->getTags() as $tag) {
27            $this->parseExtension($tag);
28        }
29    }
30
31    protected function parsingTag(): string
32    {
33        return WsdlDocument::TAG_EXTENSION;
34    }
35}