AbstractQueryBuilderAdapter   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 12
c 1
b 0
f 0
dl 0
loc 22
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getOperator() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace Mgid\Component\Pagination\Adapter\Doctrine\ODM;
4
5
use Mgid\Component\Pagination\Contract\FilterableInterface;
6
use Mgid\Component\Pagination\Adapter\QueryBuilderAdapterInterface;
7
8
abstract class AbstractQueryBuilderAdapter implements QueryBuilderAdapterInterface
9
{
10
    private const OPERATORS = [
11
        FilterableInterface::EQUAL => '$eq',
12
        FilterableInterface::NOT_EQUAL => '$ne',
13
        FilterableInterface::IN => '$in',
14
        FilterableInterface::NOT_IN => '$nin',
15
        FilterableInterface::LESS_THEN => '$lt',
16
        FilterableInterface::LESS_THEN_OR_EQUAL => '$lte',
17
        FilterableInterface::GREATER_THEN => '$gt',
18
        FilterableInterface::GREATER_THEN_OR_EQUAL => '$gte',
19
        FilterableInterface::LIKE => '$regex',
20
    ];
21
22
    /**
23
     * @param string $alias
24
     *
25
     * @return string
26
     */
27
    protected function getOperator(string $alias): string
28
    {
29
        return self::OPERATORS[$alias];
30
    }
31
}
32