Completed
Push — master ( 69d8af...43cf77 )
by Asmir
27:53
created

PhpMetadataReader::load()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 6
nc 3
nop 1
1
<?php
2
namespace GoetasWebservices\SoapServices\SoapCommon\Metadata;
3
4
class PhpMetadataReader implements MetadataReaderInterface
5
{
6
    /**
7
     * @var array
8
     */
9
    private $metadataMap = [];
10
    /**
11
     * @var array
12
     */
13
    private $metadataCache = [];
14
15
    public function __construct(array $metadataMap)
16
    {
17
        $this->metadataMap = $metadataMap;
18
    }
19
20
    public function load($wsdl)
21
    {
22
        if (!isset($this->metadataCache[$wsdl])) {
23
            if (!isset($this->metadataMap[$wsdl])) {
24
                throw new \Exception(sprintf("Can not find metadata information for %s", $wsdl));
25
            }
26
            $this->metadataCache[$wsdl] = require $this->metadataMap[$wsdl];
27
        }
28
29
        return $this->metadataCache[$wsdl];
30
    }
31
}
32