Passed
Push — main ( 8db6c4...70b583 )
by Osvaldo
01:45
created

MiddlewareControlador::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace app\librerias\controlador;
3
4
use src\contenedorId\Contenedor;
5
use src\FactoryInterface;
6
use src\MiddlewareInterface;
7
use src\PeticionInterface;
8
use const CONTROLADOR_NAMESPACE;
9
10
class MiddlewareControlador implements MiddlewareInterface
11
{
12
    public function __construct(FactoryInterface $Factory)
13
    {
14
        $this->_factory = $Factory;
0 ignored issues
show
Bug Best Practice introduced by
The property _factory does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
15
    }
16
    
17
    public function __invoke(PeticionInterface $peticion, callable $next)
18
    {
19
        $contenedor = new Contenedor();
20
21
        $controlador = $contenedor->obtener(CONTROLADOR_NAMESPACE.$peticion->controlador());
22
23
        call_user_func_array([$controlador,$peticion->metodo()], $peticion->parametros());
24
        
25
        return $next($peticion);
26
    }
27
}
28