AurynResolver   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 28
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 8 2
1
<?php
2
3
namespace Equip\Resolver;
4
5
use Auryn\Injector;
6
use Relay\ResolverInterface;
7
8
class AurynResolver implements ResolverInterface
9
{
10
    /**
11
     * @var Injector
12
     */
13
    private $injector;
14
15 27
    public function __construct(Injector $injector)
16
    {
17 27
        $this->injector = $injector;
18 27
    }
19
20
    /**
21
     * Resolve a class spec into an object, if it is not already instantiated.
22
     *
23
     * @param string|object $specOrObject
24
     *
25
     * @return object
26
     */
27 4
    public function __invoke($specOrObject)
28
    {
29 4
        if (is_object($specOrObject)) {
30 1
            return $specOrObject;
31
        }
32
33 4
        return $this->injector->make($specOrObject);
34
    }
35
}
36