Passed
Pull Request — master (#259)
by Arnaud
08:22
created

ORMDataSource::getData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 1
c 1
b 1
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace LAG\AdminBundle\Bridge\Doctrine\DataSource;
4
5
use Doctrine\ORM\QueryBuilder;
6
use LAG\AdminBundle\DataProvider\DataSourceInterface;
7
8
class ORMDataSource implements DataSourceInterface
9
{
10
    private QueryBuilder $data;
11
    private bool $pagination;
12
    private int $page;
13
    private int $maxPerPage;
14
    private array $orderBy;
15
    private array $filters;
16
17
    public function __construct(
18
        QueryBuilder $data,
19
        bool $pagination,
20
        int $page = 1,
21
        int $maxPerPage = 25,
22
        array $orderBy = [],
23
        array $filters = []
24
    ) {
25
        $this->data = $data;
26
        $this->pagination = $pagination;
27
        $this->page = $page;
28
        $this->maxPerPage = $maxPerPage;
29
        $this->orderBy = $orderBy;
30
        $this->filters = $filters;
31
    }
32
33
    public function getData(): QueryBuilder
34
    {
35
        return $this->data;
36
    }
37
38
    public function isPaginated(): bool
39
    {
40
        return $this->pagination;
41
    }
42
43
    public function getPage(): int
44
    {
45
        return $this->page;
46
    }
47
48
    public function getMaxPerPage(): int
49
    {
50
        return $this->maxPerPage;
51
    }
52
53
    public function getOrderBy(): array
54
    {
55
        return $this->orderBy;
56
    }
57
58
    public function getFilters(): array
59
    {
60
        return $this->filters;
61
    }
62
}
63