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