Passed
Push — master ( 0272f5...3a0c5f )
by Aleksandr
28:04 queued 25:53
created

QB_CONDITION   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 17
ccs 3
cts 4
cp 0.75
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A getCase() 0 9 3
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\Enum;
11
12
use Drobotik\Eav\Exception\QueryBuilderException;
13
14
class QB_CONDITION
15
{
16
    public const AND = 'and';
17
    public const OR = 'or';
18
19
    /**
20
     * @throws QueryBuilderException
21
     */
22 1
    public static function getCase(string $slug)
23
    {
24
        switch ($slug) {
25
            case self::AND:
26 1
                return self::AND;
27
            case self::OR:
28 1
                return self::OR;
29
            default:
30
                return QueryBuilderException::unsupportedCondition($slug);
31
        }
32
    }
33
}