Wsdl   A
last analyzed

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 15
cts 15
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 __construct() 0 4 1
A contentClass() 0 3 1
A getSchemas() 0 3 1
A hasSchema() 0 3 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
11
final class Wsdl extends AbstractDocument
12
{
13
    private SchemaContainer $schemas;
14
15 462
    public function __construct(Generator $generator, string $name, string $content)
16
    {
17 462
        parent::__construct($generator, $name, $content);
18 460
        $this->schemas = new SchemaContainer($generator);
19
    }
20
21 114
    public function getContent(): WsdlDocument
22
    {
23 114
        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 66
    public function addSchema(Schema $schema): self
27
    {
28 66
        $this->getContent()->addExternalSchema($schema->getContent());
29
30 66
        $this->schemas->add($schema);
31
32 66
        return $this;
33
    }
34
35 66
    public function hasSchema(string $schemaLocation): bool
36
    {
37 66
        return $this->schemas->getSchemaByName($schemaLocation) instanceof Schema;
38
    }
39
40 114
    public function getSchemas(): SchemaContainer
41
    {
42 114
        return $this->schemas;
43
    }
44
45 462
    protected function contentClass(): string
46
    {
47 462
        return WsdlDocument::class;
48
    }
49
}
50