Completed
Push — master ( 3fc573...634850 )
by WEBEWEB
11:27
created

QueryBuilderEnumerator::enumOperators()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 24

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 9.536
c 0
b 0
f 0
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\API;
13
14
/**
15
 * QueryBuilder enumerator.
16
 *
17
 * @author webeweb <https://github.com/webeweb/>
18
 * @package WBW\Bundle\JQuery\QueryBuilderBundle\API
19
 */
20
class QueryBuilderEnumerator {
21
22
    /**
23
     * Enumerates the conditions.
24
     *
25
     * @return string[] Returns the conditions enumeration.
26
     */
27
    public static function enumConditions() {
28
        return [
29
            QueryBuilderConditionInterface::CONDITION_AND,
30
            QueryBuilderConditionInterface::CONDITION_OR,
31
        ];
32
    }
33
34
    /**
35
     * Enumerates the inputs.
36
     *
37
     * @return string[] Returns the inputs enumeration.
38
     */
39
    public static function enumInputs() {
40
        return [
41
            QueryBuilderInputInterface::INPUT_CHECKBOX,
42
            QueryBuilderInputInterface::INPUT_NUMBER,
43
            QueryBuilderInputInterface::INPUT_RADIO,
44
            QueryBuilderInputInterface::INPUT_SELECT,
45
            QueryBuilderInputInterface::INPUT_TEXT,
46
            QueryBuilderInputInterface::INPUT_TEXTAREA,
47
        ];
48
    }
49
50
    /**
51
     * Enumerates the operators.
52
     *
53
     * @return array Returns the operators enumeration.
54
     */
55
    public static function enumOperators() {
56
        return [
57
            QueryBuilderOperatorInterface::OPERATOR_BEGINS_WITH      => "LIKE",
58
            QueryBuilderOperatorInterface::OPERATOR_BETWEEN          => "BETWEEN",
59
            QueryBuilderOperatorInterface::OPERATOR_CONTAINS         => "LIKE",
60
            QueryBuilderOperatorInterface::OPERATOR_ENDS_WITH        => "LIKE",
61
            QueryBuilderOperatorInterface::OPERATOR_EQUAL            => "=",
62
            QueryBuilderOperatorInterface::OPERATOR_GREATER          => ">",
63
            QueryBuilderOperatorInterface::OPERATOR_GREATER_OR_EQUAL => ">=",
64
            QueryBuilderOperatorInterface::OPERATOR_IN               => "IN",
65
            QueryBuilderOperatorInterface::OPERATOR_IS_EMPTY         => "IS NULL",
66
            QueryBuilderOperatorInterface::OPERATOR_IS_NOT_EMPTY     => "IS NOT NULL",
67
            QueryBuilderOperatorInterface::OPERATOR_IS_NOT_NULL      => "IS NOT NULL",
68
            QueryBuilderOperatorInterface::OPERATOR_IS_NULL          => "IS NULL",
69
            QueryBuilderOperatorInterface::OPERATOR_LESS             => "<",
70
            QueryBuilderOperatorInterface::OPERATOR_LESS_OR_EQUAL    => "<=",
71
            QueryBuilderOperatorInterface::OPERATOR_NOT_BEGINS_WITH  => "NOT LIKE",
72
            QueryBuilderOperatorInterface::OPERATOR_NOT_BETWEEN      => "NOT BETWEEN",
73
            QueryBuilderOperatorInterface::OPERATOR_NOT_CONTAINS     => "NOT LIKE",
74
            QueryBuilderOperatorInterface::OPERATOR_NOT_ENDS_WITH    => "NOT LIKE",
75
            QueryBuilderOperatorInterface::OPERATOR_NOT_EQUAL        => "<>",
76
            QueryBuilderOperatorInterface::OPERATOR_NOT_IN           => "NOT IN",
77
        ];
78
    }
79
80
    /**
81
     * Enumerates the types.
82
     *
83
     * @return string[] Returns the types enumeration.
84
     */
85
    public static function enumTypes() {
86
        return [
87
            QueryBuilderTypeInterface::TYPE_BOOLEAN,
88
            QueryBuilderTypeInterface::TYPE_DATE,
89
            QueryBuilderTypeInterface::TYPE_DATETIME,
90
            QueryBuilderTypeInterface::TYPE_DOUBLE,
91
            QueryBuilderTypeInterface::TYPE_INTEGER,
92
            QueryBuilderTypeInterface::TYPE_STRING,
93
            QueryBuilderTypeInterface::TYPE_TIME,
94
        ];
95
    }
96
}
97