Wsdl::getSchemas()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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