RedirectResponse   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Furious\Psr7\Response;
6
7
use Furious\Psr7\Exception\InvalidArgumentException;
8
use Furious\Psr7\Response;
9
use Psr\Http\Message\UriInterface;
10
11
class RedirectResponse extends Response
12
{
13
    public function __construct($uri, int $statusCode = 302, array $headers = [], $body = null, string $version = '1.1', string $reason = null)
14
    {
15
        if (!is_string($uri) and !$uri instanceof UriInterface) {
16
            throw new InvalidArgumentException('Uri must be a string or an instance of UriInterface');
17
        }
18
19
        parent::__construct($statusCode, $headers + [
20
            'Location' => (string) $uri
21
        ], '', $version, $reason);
22
    }
23
}