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

Service   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A resolveClass() 0 8 1
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