Completed
Push — master ( 4d66a1...40cfc1 )
by Matthieu
01:32
created

DecoratorDefinition::setExtendedDefinition()   A

Complexity

Conditions 1
Paths 1

Duplication

Lines 0
Ratio 0 %

Size

Total Lines 4
Code Lines 2

Importance

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