AbstractActivatorDecorator   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 40
c 0
b 0
f 0
wmc 6
lcom 1
cbo 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setNext() 0 5 1
A createInstance() 0 6 1
A before() 0 4 1
A after() 0 4 1
A aroundNext() 0 8 2
1
<?php
2
namespace DICIT\Activators;
3
4
use DICIT\ActivatorDecorator;
5
use DICIT\Container;
6
use DICIT\UnbuildableServiceException;
7
use DICIT\Activator;
8
9
class AbstractActivatorDecorator implements ActivatorDecorator
10
{
11
    /**
12
     *
13
     * @var Activator
14
     */
15
    protected $wrappedActivator = null;
16
17
    public function setNext(Activator $activator)
18
    {
19
        $this->wrappedActivator = $activator;
20
        return $this;
21
    }
22
23
    public function createInstance(Container $container, $serviceName, array $serviceConfig)
24
    {
25
        $this->before($container, $serviceName, $serviceConfig);
26
        $result = $this->aroundNext($container, $serviceName, $serviceConfig);
27
        return $this->after($container, $serviceName, $serviceConfig, $result);
28
    }
29
30
    protected function before(Container $container, &$serviceName, array &$serviceConfig)
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $serviceName is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $serviceConfig is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
31
    {
32
33
    }
34
35
    protected function after(Container $container, &$serviceName, array &$serviceConfig, $returnObject)
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $serviceName is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $serviceConfig is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
36
    {
37
        return $returnObject;
38
    }
39
40
    protected function aroundNext(Container $container, &$serviceName, array &$serviceConfig)
41
    {
42
        if ($this->wrappedActivator) {
43
            return $this->wrappedActivator->createInstance($container, $serviceName, $serviceConfig);
44
        }
45
46
        return null;
47
    }
48
}
49