Completed
Push — master ( 1feeef...279c4f )
by Matthieu
8s
created

DecoratorDefinition::__toString()   A

Complexity

Conditions 1
Paths 1

Duplication

Lines 0
Ratio 0 %

Size

Total Lines 4
Code Lines 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace DI\Definition;
4
5
/**
6
 * Factory that decorates a sub-definition.
7
 *
8
 * @since 5.0
9
 * @author Matthieu Napoli <[email protected]>
10
 */
11
class DecoratorDefinition extends FactoryDefinition implements Definition, HasSubDefinition
12
{
13
    /**
14
     * @var Definition
15
     */
16
    private $decorated;
17
18
    /**
19
     * @return string
20
     */
21
    public function getSubDefinitionName()
22
    {
23
        return $this->getName();
24
    }
25
26
    /**
27
     * @param Definition $definition
28
     */
29
    public function setSubDefinition(Definition $definition)
30
    {
31
        $this->decorated = $definition;
32
    }
33
34
    /**
35
     * @return Definition
36
     */
37
    public function getDecoratedDefinition()
38
    {
39
        return $this->decorated;
40
    }
41
42
    public function __toString()
43
    {
44
        return 'Decorate(' . $this->getSubDefinitionName() . ')';
45
    }
46
}
47