Passed
Push — master ( 6028dd...89a59a )
by Vitaliy
02:15
created

PaginateHandler   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 4
dl 0
loc 16
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A applyInternal() 0 8 1
1
<?php
2
3
namespace Nayjest\Querying\Handler\Doctrine;
4
5
use Nayjest\Querying\Handler\AbstractPaginateHandler;
6
use Nayjest\Querying\Operation\PaginateOperation;
7
use Doctrine\DBAL\Query\QueryBuilder;
8
9
/**
10
 * PaginateOperation handler for Doctrine.
11
 *
12
 * @see PaginateOperation
13
 */
14
class PaginateHandler extends AbstractPaginateHandler
15
{
16
    use DatabaseOperationHandlerTrait;
17
18
    /**
19
     * @param QueryBuilder $queryBuilder
20
     */
21 1
    protected function applyInternal(QueryBuilder $queryBuilder)
22
    {
23
        /** @var PaginateOperation $operation */
24 1
        $operation = $this->operation;
25
        $queryBuilder
26 1
            ->setFirstResult($this->getOffset($operation))
27 1
            ->setMaxResults($operation->getPageSize());
28 1
    }
29
}
30