Completed
Push — master ( 4f941d...095aef )
by Edson
01:55
created

Response   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 11
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A withRedirect() 0 3 1
A withJson() 0 4 1
1
<?php
2
3
namespace Bonfim\Router;
4
5
class Response
6
{
7
    public function withJson(array $json, int $code = 200)
8
    {
9
        echo json_encode($json);
10
        return http_response_code($code);
11
    }
12
13
    public function withRedirect(string $url)
14
    {
15
        return header("Location: $url");
0 ignored issues
show
Bug introduced by
Are you sure the usage of header('Location: '.$url) is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
16
    }
17
}
18