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

AliasResolver::resolve()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 8
ccs 3
cts 4
cp 0.75
crap 2.0625
rs 10
c 0
b 0
f 0
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