Passed
Push — main ( fa6287...146938 )
by Peter
09:19
created

GridFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Admin\Grid\Factory;
6
7
use AbterPhp\Framework\Grid\Component\Actions;
8
use AbterPhp\Framework\Grid\Component\Filters;
9
use AbterPhp\Framework\Grid\Grid;
10
use AbterPhp\Framework\Grid\Pagination\IPagination;
11
use AbterPhp\Framework\Grid\Table\Table;
12
use AbterPhp\Framework\Html\Attribute;
13
use AbterPhp\Framework\Html\Helper\Attributes;
14
15
class GridFactory
16
{
17
    protected const ATTRIBUTE_CLASS = 'class';
18
19
    /** @var array<string,Attribute> */
20
    protected array $attributes =  [];
21
22
    public function __construct()
23
    {
24
        $this->attributes = Attributes::fromArray([self::ATTRIBUTE_CLASS => 'grid']);
25
    }
26
27
28
    /**
29
     * @param Table        $table
30
     * @param IPagination  $pagination
31
     * @param Filters      $filters
32
     * @param Actions|null $actions
33
     *
34
     * @return Grid
35
     */
36
    public function create(Table $table, IPagination $pagination, Filters $filters, ?Actions $actions): Grid
37
    {
38
        return new Grid($table, $pagination, $filters, $actions, [], $this->attributes);
39
    }
40
}
41