Completed
Push — bulk-action-no-bc-break ( fbd3c4...2f155c )
by Kamil
23:10
created

BulkActionGridHelper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 35
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A renderBulkAction() 0 4 1
A getName() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Sylius\Bundle\GridBundle\Templating\Helper;
15
16
use Sylius\Component\Grid\Definition\Action;
17
use Sylius\Component\Grid\Definition\Field;
18
use Sylius\Component\Grid\Definition\Filter;
19
use Sylius\Component\Grid\Renderer\BulkActionGridRendererInterface;
20
use Sylius\Component\Grid\Renderer\GridRendererInterface;
21
use Sylius\Component\Grid\View\GridView;
22
use Symfony\Component\Templating\Helper\Helper;
23
24
/**
25
 * @final
26
 */
27
class BulkActionGridHelper extends Helper
28
{
29
    /**
30
     * @var BulkActionGridRendererInterface
31
     */
32
    private $bulkActionGridRenderer;
33
34
    /**
35
     * @param BulkActionGridRendererInterface $bulkActionGridRenderer
36
     */
37
    public function __construct(BulkActionGridRendererInterface $bulkActionGridRenderer)
38
    {
39
        $this->bulkActionGridRenderer = $bulkActionGridRenderer;
40
    }
41
42
    /**
43
     * @param GridView $gridView
44
     * @param Action $bulkAction
45
     * @param mixed|null $data
46
     *
47
     * @return string
48
     */
49
    public function renderBulkAction(GridView $gridView, Action $bulkAction, $data = null): string
50
    {
51
        return $this->bulkActionGridRenderer->renderBulkAction($gridView, $bulkAction, $data);
52
    }
53
54
    /**
55
     * @return string
56
     */
57
    public function getName(): string
58
    {
59
        return 'sylius_bulk_action_grid';
60
    }
61
}
62