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

PhpMetadataReader   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

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