Commands   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 10
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A redirect() 0 3 2
1
<?php
2
/**
3
 * Controller commands
4
 * User: moyo
5
 * Date: 2018/6/11
6
 * Time: 10:14 AM
7
 */
8
9
namespace Carno\Web\Chips\Controller;
10
11
use Carno\HTTP\Standard\Response;
12
13
trait Commands
14
{
15
    /**
16
     * @param string $target
17
     * @param bool $permanently
18
     * @return Response
19
     */
20
    final public function redirect(string $target, bool $permanently = false) : Response
21
    {
22
        return $this->response = new Response($permanently ? 301 : 302, ['Location' => $target]);
0 ignored issues
show
Bug Best Practice introduced by
The property response does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
23
    }
24
}
25