Completed
Push — master ( 209945...41a4bc )
by Matthew
07:41 queued 03:34
created

TableGridRenderer::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Dtc\GridBundle\Grid\Renderer;
4
5
use Symfony\Component\Routing\Router;
6
use Symfony\Bundle\TwigBundle\TwigEngine;
0 ignored issues
show
Bug introduced by
The type Symfony\Bundle\TwigBundle\TwigEngine was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
8
class TableGridRenderer extends AbstractRenderer
9
{
10
    protected $twigEngine;
11
    protected $router;
12
    protected $options = array(
13
            'table_attr' => array(
14
                    'class' => 'display table table-striped table-bordered small-font',
15
                ),
16
        );
17
18
    public function __construct(TwigEngine $twigEngine, Router $router)
19
    {
20
        $this->twigEngine = $twigEngine;
21
        $this->router = $router;
22
    }
23
24
    public function render()
25
    {
26
        $params = array(
27
                'records' => $this->gridSource->getRecords(),
28
                'columns' => $this->gridSource->getColumns(),
29
                'options' => $this->options,
30
                'source' => $this->gridSource,
31
        );
32
33
        $template = 'DtcGridBundle:Grid:table.html.twig';
34
35
        return $this->twigEngine->render($template, $params);
36
    }
37
38
    /**
39
     * @param array|null $params
40
     */
41
    public function getParams(array &$params = null)
42
    {
43
        if (null === $params) {
44
            $params = [];
45
        }
46
        parent::getParams($params);
47
48
        return $params;
49
    }
50
}
51