ArrayMetadataLoader   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 7
c 0
b 0
f 0
dl 0
loc 24
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addMetadata() 0 3 1
A __construct() 0 3 1
A load() 0 7 2
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