Completed
Push — master ( 7e3b96...cb9969 )
by Vitaly
03:03
created

ClassName   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 38
ccs 6
cts 12
cp 0.5
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A toClassMetadata() 0 4 1
A toPropertyMetadata() 0 4 1
A toParameterMetadata() 0 4 1
1
<?php declare(strict_types = 1);
2
/**
3
 * Created by PhpStorm.
4
 * User: root
5
 * Date: 27.07.2016
6
 * Time: 1:55.
7
 */
8
namespace samsonframework\containercollection\attribute;
9
10
use samsonframework\container\configurator\ClassConfiguratorInterface;
11
use samsonframework\container\configurator\ParameterConfiguratorInterface;
12
use samsonframework\container\configurator\PropertyConfiguratorInterface;
13
use samsonframework\container\metadata\ClassMetadata;
14
use samsonframework\container\metadata\ParameterMetadata;
15
use samsonframework\container\metadata\PropertyMetadata;
16
17
/**
18
 * Class name attribute configurator class.
19
 *
20
 * @see    \samsonframework\container\configurator\ScopeConfigurator
21
 *
22
 * @author Vitaly Egorov <[email protected]>
23
 *
24
 */
25
class ClassName implements ClassConfiguratorInterface, PropertyConfiguratorInterface, ParameterConfiguratorInterface, AttributeConfiguratorInterface
26
{
27
    /** @var string Configurator key */
28
    const KEY = 'class';
29
30
    /**
31
     * @var string Dependency class name
32
     */
33
    protected $className;
34
35
    /**
36
     * Class collection configurator constructor.
37
     *
38
     * @param string $className Class name
39
     */
40 2
    public function __construct(string $className)
41
    {
42 2
        $this->className = $className;
43 2
    }
44
45
    /* {@inheritDoc} */
46
    public function toClassMetadata(ClassMetadata $classMetadata)
47
    {
48
        $classMetadata->className = $this->className;
49
    }
50
51
    /* {@inheritDoc} */
52
    public function toPropertyMetadata(PropertyMetadata $propertyMetadata)
53
    {
54
        $propertyMetadata->dependency = $this->className;
55
    }
56
57
    /* {@inheritDoc} */
58 1
    public function toParameterMetadata(ParameterMetadata $parameterMetadata)
59
    {
60 1
        $parameterMetadata->dependency = $this->className;
61 1
    }
62
}
63