Passed
Push — master ( 61ffee...578120 )
by Aleksandr
13:14
created

QueryBuilderException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 25
ccs 6
cts 6
cp 1
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A unsupportedAttribute() 0 3 1
A unsupportedCondition() 0 3 1
A unsupportedOperator() 0 3 1
1
<?php
2
/**
3
 * This file is part of the eav package.
4
 * @author    Aleksandr Drobotik <[email protected]>
5
 * @copyright 2023 Aleksandr Drobotik
6
 * @license   https://opensource.org/license/mit  The MIT License
7
 */
8
declare(strict_types=1);
9
10
namespace Drobotik\Eav\Exception;
11
12
class QueryBuilderException extends \Exception
13
{
14
    public const UNSUPPORTED_OPERATOR = "unsupported operator %s";
15
    public const UNSUPPORTED_ATTRIBUTE = "unsupported attribute %s";
16
    public const UNSUPPORTED_CONDITION = "unsupported condition %s";
17
    /**
18
     * @throws QueryBuilderException
19
     */
20 1
    public static function unsupportedOperator(string $operator)
21
    {
22 1
        throw new static(sprintf(self::UNSUPPORTED_OPERATOR, $operator));
23
    }
24
    /**
25
     * @throws QueryBuilderException
26
     */
27 1
    public static function unsupportedAttribute(string $name)
28
    {
29 1
        throw new static(sprintf(self::UNSUPPORTED_ATTRIBUTE, $name));
30
    }
31
    /**
32
     * @throws QueryBuilderException
33
     */
34 1
    public static function unsupportedCondition(string $name)
35
    {
36 1
        throw new static(sprintf(self::UNSUPPORTED_CONDITION, $name));
37
    }
38
}