Test Failed
Push — master ( 2d2904...3a3b03 )
by Mehmet
02:26
created

Middleware   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 29
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A process() 0 17 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Selami\Middleware\Authentication;
5
6
use Psr\Http\Message\ResponseInterface;
7
use Psr\Http\Message\ServerRequestInterface;
8
use Psr\Http\Server\MiddlewareInterface;
9
use Psr\Http\Server\RequestHandlerInterface;
10
use Zend\Diactoros\Response;
11
use Psr\Container\ContainerInterface;
12
use Selami\Foundation\App as SelamiApplication;
13
14
class Middleware implements MiddlewareInterface
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
        $urlPath = $request->getUri()->getPath();
26
        //var_dump($urlPath .'<<<-');
0 ignored issues
show
Unused Code Comprehensibility introduced by
63% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
27
        $appRoutes = require __DIR__ . '/routes.php';
28
        $config = $this->container->get('config');
29
        $config['app']['cache_file'] = './cache/authentication.fastroute.cache';
30
        $this->container->setAllowOverride(true);
31
        $this->container->setService('config', $config);
32
        $this->container->setService('routes', $appRoutes);
33
        $this->container->setService(ServerRequestInterface::class, $request);
34
        $this->container->setAllowOverride(false);
35
36
        $myApp = $this->container->get(SelamiApplication::class);
37
        $response =  $myApp($request, new Response());
38
        return $response;
39
    }
40
41
42
}