OrExpr   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 91.67%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 12
c 1
b 0
f 0
dl 0
loc 31
ccs 11
cts 12
cp 0.9167
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 20 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Noitran\RQL\Expressions;
6
7
use Noitran\RQL\Exceptions\ExpressionException;
8
9
/**
10
 * Class OrExpr.
11
 */
12
class OrExpr extends AbstractExpr
13
{
14
    /**
15
     * OrExpr constructor.
16
     *
17
     * @param string|null $relation
18
     * @param string $column
19
     * @param $value
20
     *
21
     * @throws ExpressionException
22
     */
23 1
    public function __construct(?string $relation, string $column, $value)
24
    {
25 1
        if (\is_string($value)) {
26 1
            $value = array_filter(
27 1
                $this->valueToArray('|', trim($value))
28
            );
29
        }
30
31 1
        if (\count($value) < 2) {
32
            throw new ExpressionException('The number of "values" must be greater than one');
33
        }
34
35 1
        parent::__construct(
36 1
            $relation,
37 1
            $column,
38 1
            $value
39
        );
40
41 1
        $this->setExpression('$or');
42 1
        $this->setOperator();
43 1
    }
44
}
45