Completed
Push — master ( cdd5fc...46341a )
by WEBEWEB
01:20
created

NotEndsWithQueryBuilderOperator::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
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\QueryBuilderDecoratorFactory;
16
17
/**
18
 * Not ends with QueryBuilder operator.
19
 *
20
 * @author webeweb <https://github.com/webeweb/>
21
 * @package WBW\Bundle\JQuery\QueryBuilderBundle\Decorator\Operator
22
 */
23
class NotEndsWithQueryBuilderOperator extends AbstractQueryBuilderOperator {
24
25
    /**
26
     * Constructor.
27
     */
28
    public function __construct() {
29
        parent::__construct(self::OPERATOR_NOT_ENDS_WITH);
30
    }
31
32
    /**
33
     * {@inheritDoc}
34
     */
35
    public function toSQL(QueryBuilderRuleInterface $rule, $wrap = false) {
36
37
        $qbt = QueryBuilderDecoratorFactory::newQueryBuilderType($rule->getType());
38
39
        $sql = [
40
            parent::toSQL($rule, $wrap),
41
            "'%" . $qbt->toSQL($rule, false) . "'",
42
        ];
43
44
        return implode(" ", $sql);
45
    }
46
}
47