GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Failed
Push — master ( b4390b...d91f3b )
by cao
04:15
created

ResponseRenderer::render()   B

Complexity

Conditions 5
Paths 4

Size

Total Lines 23
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 6.7458

Importance

Changes 0
Metric Value
cc 5
eloc 13
nc 4
nop 1
dl 0
loc 23
ccs 10
cts 17
cp 0.5881
crap 6.7458
rs 8.5906
c 0
b 0
f 0
1
<?php
2
3
namespace PhpBoot\Controller;
4
5
6
use Symfony\Component\HttpFoundation\Response;
7
8
class ResponseRenderer
9
{
10
    /**
11
     * @param array $output
12
     * @return string
13
     */
14 1
    public function render(array $output)
15
    {
16 1
        $response = new Response();
17 1
        $response->headers->set('Content-Type', 'application/json');
18 1
        foreach ($output as $key=>$value){
19
            //TODO 支持自定义格式输出
20
            //TODO 支持更多的输出目标
21 1
            if($key == 'content'){
22 1
                //if(is_array($value) || is_object($value)){
0 ignored issues
show
Unused Code Comprehensibility introduced by
74% 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...
23
                    $value = json_encode($value, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
24
                //}
25 1
                $response->setContent($value);
26 1
            }elseif($key == 'headers'){
27
                foreach ($value as $k=>$v){
28
                    $response->headers->set($k, $v);
29
                }
30
            }else{
31
                \PhpBoot\abort(new \UnexpectedValueException("Unexpected output target $key"));
32
            }
33
34 1
        }
35 1
        return $response;
36
    }
37
}