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

NotBetweenQueryBuilderOperator::toSql()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 2
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\QueryBuilderConditionInterface;
15
use WBW\Bundle\JQuery\QueryBuilderBundle\API\QueryBuilderRuleInterface;
16
use WBW\Bundle\JQuery\QueryBuilderBundle\Decorator\Type\ArrayQueryBuilderType;
17
18
/**
19
 * Not between QueryBuilder operator.
20
 *
21
 * @author webeweb <https://github.com/webeweb/>
22
 * @package WBW\Bundle\JQuery\QueryBuilderBundle\Decorator\Operator
23
 */
24
class NotBetweenQueryBuilderOperator extends AbstractQueryBuilderOperator implements QueryBuilderConditionInterface {
25
26
    /**
27
     * Constructor.
28
     */
29
    public function __construct() {
30
        parent::__construct(self::OPERATOR_NOT_BETWEEN);
31
    }
32
33
    /**
34
     * {@inheritDoc}
35
     */
36
    public function toSql(QueryBuilderRuleInterface $rule, bool $wrap = false): string {
37
38
        $qbt = new ArrayQueryBuilderType();
39
        $tmp = $qbt->toSql($rule, true);
40
41
        $sql = [
42
            parent::toSql($rule, $wrap),
43
            str_replace("{{implode}}", " " . self::CONDITION_AND . " ", $tmp),
44
        ];
45
46
        return implode(" ", $sql);
47
    }
48
}
49