ClassName   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 50%

Importance

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

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
 * @author Vitaly Egorov <[email protected]>
21
 */
22
class ClassName implements ClassConfiguratorInterface, PropertyConfiguratorInterface, ParameterConfiguratorInterface, AttributeConfiguratorInterface
23
{
24
    /** @var string Configurator key */
25
    const KEY = 'class';
26
27
    /**
28
     * @var string Dependency class name
29
     */
30
    protected $className;
31
32
    /**
33
     * Class collection configurator constructor.
34
     *
35
     * @param string $className Class name
36
     */
37 2
    public function __construct(string $className)
38
    {
39 2
        $this->className = $className;
40 2
    }
41
42
    /* {@inheritDoc} */
43
    public function toClassMetadata(ClassMetadata $classMetadata)
44
    {
45
        $classMetadata->className = $this->className;
46
    }
47
48
    /* {@inheritDoc} */
49
    public function toPropertyMetadata(PropertyMetadata $propertyMetadata)
50
    {
51
        $propertyMetadata->dependency = $this->className;
52
    }
53
54
    /* {@inheritDoc} */
55 1
    public function toParameterMetadata(ParameterMetadata $parameterMetadata)
56
    {
57 1
        $parameterMetadata->dependency = $this->className;
58 1
    }
59
}
60