UserComparison::isFieldEqual()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 1
1
<?php
2
3
namespace PhpAbac\Comparison;
4
5
class UserComparison extends AbstractComparison
6
{
7 2
    public function isFieldEqual(string $attributeId, $value, array $extraData = []): bool
8
    {
9 2
        $attributeManager = $this->comparisonManager->getAttributeManager();
10
        // Create an attribute out of the extra data we have and compare its retrieved value to the expected one
11 2
        return $attributeManager->retrieveAttribute(
12 2
            $attributeManager->getAttribute($attributeId),
13 2
            $extraData['user']
14 2
        ) === $value;
15
    }
16
}
17