Test Failed
Push — master ( 9ef00c...2d2904 )
by Mehmet
05:07
created

Middleware::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Selami\Middleware\Auth;
5
use Selami\Foundation\App as SelamiAuth;
6
7
use Psr\Http\Message\ResponseInterface;
8
use Psr\Http\Message\ServerRequestInterface;
9
use Psr\Http\Server\MiddlewareInterface;
10
use Psr\Http\Server\RequestHandlerInterface;
11
use Zend\Diactoros\Response;
12
use Psr\Container\ContainerInterface;
13
14 View Code Duplication
class Middleware implements MiddlewareInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
15
{
16
    private $container;
17
18
    public function __construct(ContainerInterface $container)
19
    {
20
        $this->container = $container;
21
    }
22
23
    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
24
    {
25
        $appRoutes = require __DIR__ . '/routes.php';
26
        $this->container->setService('routes', $appRoutes);
27
        $this->container->setService(ServerRequestInterface::class, $request);
28
        $myApp = $this->container->get('SelamiAuth');
29
        return $myApp($request, new Response());
30
    }
31
32
33
}