CallbackWrapper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 2
c 1
b 1
f 0
lcom 0
cbo 0
dl 0
loc 22
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 4 1
A __construct() 0 5 1
1
<?php
2
namespace Acelaya\SlimContainerSm\Factory;
3
4
use Acelaya\SlimContainerSm\Container;
5
6
/**
7
 * This is used to wrapp services created with callbacks that have to be invoked,
8
 * this way a SM factory can be created that returns the result of the original factory
9
 * @author
10
 * @link
11
 */
12
class CallbackWrapper
13
{
14
    /**
15
     * @var Container
16
     */
17
    protected $container;
18
    /**
19
     * @var callable
20
     */
21
    protected $originalFactory;
22
23 4
    public function __construct(Container $container, callable $originalFactory)
24
    {
25 4
        $this->container = $container;
26 4
        $this->originalFactory = $originalFactory;
27 4
    }
28
29 3
    public function __invoke($sm)
0 ignored issues
show
Unused Code introduced by
The parameter $sm 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...
30
    {
31 3
        return call_user_func($this->originalFactory, $this->container);
32
    }
33
}
34