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

SortHandler::applyInternal()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 7
cts 7
cp 1
rs 9.6666
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\AbstractHandler;
6
use Doctrine\DBAL\Query\QueryBuilder;
7
use Nayjest\Querying\Operation\SortOperation;
8
9
/**
10
 * SortOperation handler for Doctrine.
11
 *
12
 * @see SortOperation
13
 */
14
class SortHandler extends AbstractHandler
15
{
16
    use DatabaseOperationHandlerTrait;
17
18
    /**
19
     * @param QueryBuilder $queryBuilder
20
     */
21 1
    protected function applyInternal(QueryBuilder $queryBuilder)
22
    {
23
        /** @var SortOperation $operation */
24 1
        $operation = $this->operation;
25 1
        $queryBuilder->orderBy(
26 1
            $operation->getField(),
27 1
            $operation->getOrder()
28 1
        );
29 1
    }
30
}
31