Completed
Push — master ( f27e2e...5dd696 )
by Asmir
10s
created

ArrayMetadataLoader   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 25
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A addMetadata() 0 4 1
A load() 0 7 2
1
<?php
2
namespace GoetasWebservices\SoapServices\SoapClient\Metadata\Loader;
3
4
use GoetasWebservices\SoapServices\SoapClient\Exception\MetadataException;
5
6
class ArrayMetadataLoader implements MetadataLoaderInterface
7
{
8
    /**
9
     * @var array
10
     */
11
    private $metadata = [];
12
13
    public function __construct(array $metadata)
14
    {
15
        $this->metadata = $metadata;
16
    }
17
18
    public function addMetadata($wsdl, array $metadata)
19
    {
20
        $this->metadata[$wsdl] = $metadata;
21
    }
22
23
    public function load($wsdl)
24
    {
25
        if (!isset($this->metadata[$wsdl])) {
26
            throw new MetadataException(sprintf("Can not load metadata information for %s", $wsdl));
27
        }
28
        return $this->metadata[$wsdl];
29
    }
30
}
31