EqualToValue::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 3
crap 1
1
<?php
2
/**
3
 *
4
 * This file is part of Aura for PHP.
5
 *
6
 * @license http://opensource.org/licenses/bsd-license.php BSD
7
 *
8
 */
9
namespace Aura\Filter\Rule\Validate;
10
11
/**
12
 *
13
 * Validates that this value is loosely equal to another value.
14
 *
15
 * @package Aura.Filter
16
 *
17
 */
18
class EqualToValue
19
{
20
    /**
21
     *
22
     * Validates that this value is loosely equal to another value.
23
     *
24
     * @param object $subject The subject to be filtered.
25
     *
26
     * @param string $field The subject field name.
27
     *
28
     * @param mixed $other_value The other value.
29
     *
30
     * @return bool True if the values are equal, false if not equal.
31
     *
32
     */
33 6
    public function __invoke($subject, $field, $other_value)
34
    {
35 6
        return $subject->$field == $other_value;
36
    }
37
}
38