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

PaginateHandler::applyInternal()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
nc 1
cc 1
eloc 5
nop 1
crap 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