Completed
Push — master ( aa02db...c8592c )
by WEBEWEB
09:51
created

NotInQueryBuilderOperator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A toSql() 0 12 1
1
<?php
2
3
/*
4
 * This file is part of the jquery-querybuilder-bundle package.
5
 *
6
 * (c) 2019 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Bundle\JQuery\QueryBuilderBundle\Decorator\Operator;
13
14
use WBW\Bundle\JQuery\QueryBuilderBundle\API\QueryBuilderRuleInterface;
15
use WBW\Bundle\JQuery\QueryBuilderBundle\Decorator\Type\ArrayQueryBuilderType;
16
17
/**
18
 * Not in QueryBuilder operator.
19
 *
20
 * @author webeweb <https://github.com/webeweb/>
21
 * @package WBW\Bundle\JQuery\QueryBuilderBundle\Decorator\Operator
22
 */
23
class NotInQueryBuilderOperator extends AbstractQueryBuilderOperator {
24
25
    /**
26
     * Constructor.
27
     */
28
    public function __construct() {
29
        parent::__construct(self::OPERATOR_NOT_IN);
30
    }
31
32
    /**
33
     * {@inheritDoc}
34
     */
35
    public function toSql(QueryBuilderRuleInterface $rule, bool $wrap = false): string {
36
37
        $qbt = new ArrayQueryBuilderType();
38
        $tmp = $qbt->toSql($rule, true);
39
40
        $sql = [
41
            parent::toSql($rule, $wrap),
42
            "(" . str_replace("{{implode}}", ", ", $tmp) . ")",
43
        ];
44
45
        return implode(" ", $sql);
46
    }
47
}
48