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

Wsdl::hasSchema()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 0
cp 0
crap 2
rs 10
c 0
b 0
f 0
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