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.
Completed
Pull Request — master (#18)
by
unknown
02:20
created

JsonRenderer::render()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 20
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 3.4746

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 20
ccs 10
cts 16
cp 0.625
rs 9.4285
cc 3
eloc 13
nc 2
nop 1
crap 3.4746
1
<?php
2
3
namespace CrossKnowledge\DataTableBundle\DataTable\Renderer;
4
5
use CrossKnowledge\DataTableBundle\DataTable\Table\AbstractTable;
6
use Symfony\Component\HttpFoundation\JsonResponse;
7
8
class JsonRenderer implements RendererInterface
9
{
10 2
    public function render(AbstractTable $table)
11
    {
12 2
        $jsonVars = [];
13 2
        $jsonVars['recordsTotal'] = $table->getUnfilteredCount();
14 2
        $filterCount = $table->getFilteredCount();
15 2
        $jsonVars['recordsFiltered'] = $filterCount!==false ? $filterCount : $jsonVars['recordsTotal'];
16 2
        $jsonVars['data'] = array_map(
17 2
            function ($item) {
18
                $t = [];
19
                foreach ($item as $k => $v) {
20
                    $t[] = $v;
21
                }
22
23
                return $t;
24 2
            },
25 2
            $table->getOutputRows()
26 2
        );
27
28
        return json_encode($jsonVars);
29
    }
30
31 1
    public function renderJsonResponse(AbstractTable $table)
32
    {
33 1
        $response = new JsonResponse();
34 1
        $response->setContent($this->render($table));
35
36
        return $response;
37
    }
38
}
39