Issues (117)

Grid/Renderer/TableGridRenderer.php (2 issues)

1
<?php
2
3
namespace Dtc\GridBundle\Grid\Renderer;
4
5
use Symfony\Component\Routing\RouterInterface;
0 ignored issues
show
The type Symfony\Component\Routing\RouterInterface 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...
6
use Twig\Environment;
0 ignored issues
show
The type Twig\Environment 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
    public static $defaultOptions = [
11
        'table_attr' => [
12
            'class' => 'display table table-striped table-bordered small-font',
13
        ],
14
    ];
15
16
    protected $twig;
17
    protected $router;
18
    protected $translator;
19
    protected $options;
20
21
    public function __construct(Environment $twig, RouterInterface $router, $translator, array $options)
22
    {
23
        $this->translator = $translator;
24
        $this->twig = $twig;
25
        $this->router = $router;
26
        $this->options = $options;
27
    }
28
29
    public function render()
30
    {
31
        $params = [
32
                'records' => $this->gridSource->getRecords(),
33
                'columns' => $this->gridSource->getColumns(),
34
                'options' => $this->options,
35
                'source' => $this->gridSource,
36
        ];
37
38
        $template = '@DtcGrid/Grid/table.html.twig';
39
40
        return $this->twig->render($template, $params);
41
    }
42
43
    public function getParams(array &$params = null)
44
    {
45
        if (null === $params) {
46
            $params = [];
47
        }
48
        parent::getParams($params);
49
50
        return $params;
51
    }
52
}
53