Completed
Push — master ( 1fe708...6360f1 )
by Arnaud
16s queued 12s
created

ORMDataSource::getData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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