ArrayMetadataLoader::load()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 7
rs 10
cc 2
nc 2
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GoetasWebservices\SoapServices\Metadata\Loader;
6
7
use GoetasWebservices\SoapServices\Metadata\Exception\MetadataException;
8
9
class ArrayMetadataLoader implements MetadataLoaderInterface
10
{
11
    /**
12
     * @var array
13
     */
14
    private $metadata = [];
15
16
    public function __construct(array $metadata)
17
    {
18
        $this->metadata = $metadata;
19
    }
20
21
    public function addMetadata(string $wsdl, array $metadata): void
22
    {
23
        $this->metadata[$wsdl] = $metadata;
24
    }
25
26
    public function load(string $wsdl): array
27
    {
28
        if (!isset($this->metadata[$wsdl])) {
29
            throw new MetadataException(sprintf('Can not load metadata information for %s', $wsdl));
30
        }
31
32
        return $this->metadata[$wsdl];
33
    }
34
}
35