Resolver   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 12 4
1
<?php
2
/**
3
 * This file is part of the BEAR.Middleware package.
4
 *
5
 * @license http://opensource.org/licenses/MIT MIT
6
 */
7
namespace BEAR\Middleware;
8
9
use Ray\Di\InjectorInterface;
10
11
final class Resolver
12
{
13
    /**
14
     * @var InjectorInterface
15
     */
16
    private $injector;
17
18 2
    public function __construct(InjectorInterface $injector)
19
    {
20 2
        $this->injector = $injector;
21 2
    }
22
23 2
    public function __invoke($spec)
24
    {
25 2
        if (is_string($spec)) {
26 2
            return $this->injector->getInstance($spec);
27
        }
28
29 1
        if (is_array($spec) && is_string($spec[0])) {
30 1
            $spec[0] = $this->injector->getInstance($spec[0]);
31
        }
32
33 1
        return $spec;
34
    }
35
}
36