Completed
Push — master ( 00ced4...d3edd8 )
by
unknown
07:54
created

Service::resolveClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 3
1
<?php declare(strict_types = 1);
2
/**
3
 * Created by Ruslan Molodyko.
4
 * Date: 10.09.2016
5
 * Time: 15:33
6
 */
7
namespace samsonframework\container\definition\analyzer\annotation\annotation;
8
9
use samsonframework\container\definition\analyzer\annotation\ResolveClassInterface;
10
use samsonframework\container\definition\analyzer\DefinitionAnalyzer;
11
use samsonframework\container\definition\analyzer\exception\WrongAnnotationConstructorException;
12
use samsonframework\container\definition\ClassDefinition;
13
use samsonframework\container\definition\MethodDefinition;
14
use samsonframework\container\definition\PropertyDefinition;
15
use samsonframework\container\definition\reference\ClassReference;
16
17
/**
18
 * Injection annotation class.
19
 *
20
 * @Annotation
21
 */
22
class Service implements ResolveClassInterface
23
{
24
    /** @var mixed */
25
    protected $value;
26
27
    /**
28
     * Inject constructor.
29
     *
30
     * @param $value
31
     */
32
    public function __construct($value)
33
    {
34
        $this->value = $value;
35
    }
36
37
    /** {@inheritdoc} */
38
    public function resolveClass(
39
        DefinitionAnalyzer $analyzer,
40
        ClassDefinition $classDefinition,
41
        \ReflectionClass $reflectionClass
42
    ) {
43
        $classDefinition->setServiceName($this->value['value']);
44
        $classDefinition->setIsSingleton(true);
45
    }
46
}
47