Redirect   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 5 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Acelaya\Website\Action;
5
6
use Interop\Http\ServerMiddleware\DelegateInterface;
7
use Interop\Http\ServerMiddleware\MiddlewareInterface;
8
use Psr\Http\Message\ResponseInterface;
9
use Psr\Http\Message\ServerRequestInterface;
10
use Zend\Diactoros\Response\RedirectResponse;
11
12
class Redirect implements MiddlewareInterface
13
{
14
    /**
15
     * Process an incoming server request and return a response, optionally delegating
16
     * to the next middleware component to create the response.
17
     *
18
     * @param ServerRequestInterface $request
19
     * @param DelegateInterface $delegate
20
     *
21
     * @return ResponseInterface
22
     */
23
    public function process(ServerRequestInterface $request, DelegateInterface $delegate)
24
    {
25
        $to = $request->getAttribute('to');
26
        return new RedirectResponse($to, 301);
27
    }
28
}
29