LocationPriority::accept()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
c 0
b 0
f 0
rs 10
cc 2
nc 2
nop 1
1
<?php
2
3
namespace Kaliop\EzFindSearchEngineBundle\Core\Persistence\eZFind\Content\Search\Common\Gateway\SortClauseHandler;
4
5
use eZ\Publish\API\Repository\Values\Content\Query\SortClause;
6
use Kaliop\EzFindSearchEngineBundle\Core\Persistence\eZFind\Content\Search\Common\Gateway\SortClauseHandler;
7
8
class LocationPriority extends SortClauseHandler
9
{
10
    public function accept(SortClause $sortClause)
11
    {
12
        // Handling both deprecated priority clause and the new one.
13
        return ($sortClause instanceof SortClause\Location\Priority) || ($sortClause instanceof SortClause\LocationPriority);
14
    }
15
16
    public function handle(SortClause $sortClause)
17
    {
18
        return [
19
            'main_node_meta_priority_si' => $this->getDirection($sortClause),
20
        ];
21
    }
22
}
23