CallbackWrapper::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 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