EqualStrictExpression::evaluate()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 5
nc 4
nop 2
dl 0
loc 11
ccs 6
cts 6
cp 1
crap 3
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
/**
4
 * @license     http://opensource.org/licenses/mit-license.php MIT
5
 * @link        https://github.com/nicoSWD
6
 * @author      Nicolas Oelgart <[email protected]>
7
 */
8
namespace nicoSWD\Rule\Expression;
9
10
use nicoSWD\Rule\TokenStream\TokenCollection;
11
12
final class EqualStrictExpression extends BaseExpression
13
{
14 146
    public function evaluate(mixed $leftValue, mixed $rightValue): bool
15
    {
16 146
        if ($leftValue instanceof TokenCollection) {
17 12
            $leftValue = $leftValue->toArray();
18
        }
19
20 146
        if ($rightValue instanceof TokenCollection) {
21 30
            $rightValue = $rightValue->toArray();
22
        }
23
24 146
        return $leftValue === $rightValue;
25
    }
26
}
27