Completed
Push — master ( 6373f2...b930c3 )
by Dmitry
02:29
created

AbstractAttribute::getRuleForOperator()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 0
cts 2
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
crap 6
1
<?php
2
3
namespace hiapi\query\attributes;
4
5
abstract class AbstractAttribute implements AttributeInterface
6
{
7
    abstract protected function getOperatorRules();
8
9
    public function getRuleForOperator($operator)
10
    {
11
        $rules = $this->getOperatorRules();
12
13
        if (isset($rules[$operator])) {
14
            return $rules[$operator];
15
        }
16
17
        throw UnsupportedOperatorException::forOperator($operator);
18
    }
19
}
20