Completed
Push — EZP-31084-part2-poc ( f20bda )
by André
19:16
created

LogicalNot   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A accept() 0 4 1
A handle() 0 5 1
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
namespace eZ\Publish\Core\Persistence\Legacy\Content\Query\CriterionHandler;
8
9
use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
10
use eZ\Publish\Core\Persistence\Legacy\Content\Query\CriteriaConverter;
11
use eZ\Publish\Core\Persistence\Legacy\Content\Query\CriterionHandler;
12
use Doctrine\DBAL\Query\QueryBuilder;
13
14
class LogicalNot implements CriterionHandler
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function accept(Criterion $criterion): bool
20
    {
21
        return $criterion instanceof Criterion\LogicalNot;
22
    }
23
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function handle(CriteriaConverter $converter, QueryBuilder $query, Criterion $criterion)
28
    {
29
        /** @var Criterion\LogicalOperator $criterion */
30
        return 'NOT ' . $converter->convertCriteria($query, $criterion->criteria[0]);
31
    }
32
}
33