Passed
Push — develop ( 393819...8447c9 )
by Mikaël
74:52 queued 24:50
created

Wsdl   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 37
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getContent() 0 3 1
A contentClass() 0 3 1
A getSchemas() 0 3 1
A hasSchema() 0 3 1
A __construct() 0 4 1
A addSchema() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace WsdlToPhp\PackageGenerator\Model;
6
7
use WsdlToPhp\PackageGenerator\Container\Model\Schema as SchemaContainer;
8
use WsdlToPhp\PackageGenerator\Generator\Generator;
9
use WsdlToPhp\WsdlHandler\Wsdl as WsdlDocument;
10 1086
11
final class Wsdl extends AbstractDocument
12 1086
{
13
    private SchemaContainer $schemas;
14
15
    public function __construct(Generator $generator, string $name, string $content)
16
    {
17 474
        parent::__construct($generator, $name, $content);
18
        $this->schemas = new SchemaContainer($generator);
19 474
    }
20
21
    public function getContent(): WsdlDocument
22
    {
23
        return parent::getContent();
0 ignored issues
show
Bug Best Practice introduced by
The expression return parent::getContent() returns the type WsdlToPhp\WsdlHandler\AbstractDocument which includes types incompatible with the type-hinted return WsdlToPhp\WsdlHandler\Wsdl.
Loading history...
24
    }
25
26
    public function addSchema(Schema $schema): self
27
    {
28
        $this->getContent()->addExternalSchema($schema->getContent());
29
30
        $this->schemas->add($schema);
31
32
        return $this;
33
    }
34
35
    public function hasSchema(string $schemaLocation): bool
36
    {
37
        return $this->schemas->getSchemaByName($schemaLocation) instanceof Schema;
38
    }
39
40
    public function getSchemas(): SchemaContainer
41
    {
42
        return $this->schemas;
43
    }
44
45
    protected function contentClass(): string
46
    {
47
        return WsdlDocument::class;
48
    }
49
}
50