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

ArrayMetadataLoader::load()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

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