Completed
Pull Request — master (#14)
by Pavel
03:32
created

ConstructorFactoryResolver   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolve() 0 8 2
1
<?php
2
3
namespace Bankiru\Api\Doctrine;
4
5
use Bankiru\Api\Doctrine\ApiFactory\StaticApiFactory;
6
7
final class ConstructorFactoryResolver implements ApiFactoryResolverInterface
8
{
9
    /** @var  ApiFactoryInterface[] */
10
    private $factories = [];
11
12
    /** {@inheritdoc} */
13 17
    public function resolve($name)
14
    {
15 17
        if (!array_key_exists($name, $this->factories)) {
16 17
            $this->factories[$name] = new StaticApiFactory($name);
17 17
        }
18
19 17
        return $this->factories[$name];
20
    }
21
}
22