Completed
Push — master ( 5a2a79...584535 )
by Miloš
01:11
created

AliasResolver   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 3
cts 4
cp 0.75
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolve() 0 8 2
1
<?php
2
3
namespace Laganica\Di\Resolver;
4
5
use InvalidArgumentException;
6
use Laganica\Di\Definition\DefinitionInterface;
7
8
/**
9
 * Class AliasResolver
10
 *
11
 * @package Laganica\Di\Resolver
12
 */
13
class AliasResolver extends ReflectionResolver
14
{
15
    /**
16
     * @inheritDoc
17
     */
18 1
    public function resolve(DefinitionInterface $definition)
19
    {
20 1
        if (!is_string($definition->getValue())) {
21
            throw new InvalidArgumentException('Value of $definition->getValue() must be string');
22
        }
23
24 1
        return $this->getContainer()->get($definition->getValue());
25
    }
26
}
27