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

QB_CONDITION::getCase()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 3.1406

Importance

Changes 0
Metric Value
cc 3
eloc 7
nc 3
nop 1
dl 0
loc 9
ccs 3
cts 4
cp 0.75
crap 3.1406
rs 10
c 0
b 0
f 0
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
}