1<?php
2
3/**
4 * This file is part of the FreeDSx LDAP package.
5 *
6 * (c) Chad Sikorra <Chad.Sikorra@gmail.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace FreeDSx\Ldap\Search\Filter;
13
14use FreeDSx\Ldap\Protocol\ProtocolElementInterface;
15
16/**
17 * Used to represent filters for search requests.
18 *
19 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
20 */
21interface FilterInterface extends ProtocolElementInterface
22{
23    public const PAREN_LEFT = '(';
24
25    public const PAREN_RIGHT = ')';
26
27    public const OPERATOR_AND = '&';
28
29    public const OPERATOR_OR = '|';
30
31    public const OPERATOR_NOT = '!';
32
33    public const FILTER_EQUAL = '=';
34
35    public const FILTER_APPROX = '~=';
36
37    public const FILTER_GTE = '>=';
38
39    public const FILTER_LTE = '<=';
40
41    public const FILTER_EXT = ':=';
42
43    public const OPERATORS = [
44        self::OPERATOR_NOT,
45        self::OPERATOR_OR,
46        self::OPERATOR_AND,
47    ];
48
49    public const FILTERS = [
50        self::FILTER_EQUAL,
51        self::FILTER_APPROX,
52        self::FILTER_GTE,
53        self::FILTER_LTE,
54        self::FILTER_EXT,
55    ];
56
57    /**
58     * Get the string representation of the filter.
59     *
60     * @return string
61     */
62    public function toString(): string;
63}
64