ArrayMetadataLoader::load()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

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