Test Failed
Push — master ( 72a6c5...9329b7 )
by Arun
03:52
created

PropertyMatcher::matches()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace DeepCopy\Matcher;
4
5
/**
6
 * Match a specific property of a specific class
7
 */
8
class PropertyMatcher implements Matcher
9
{
10
    /**
11
     * @var string
12
     */
13
    private $class;
14
15
    /**
16
     * @var string
17
     */
18
    private $property;
19
20
    /**
21
     * @param string $class    Class name
22
     * @param string $property Property name
23
     */
24
    public function __construct($class, $property)
25
    {
26
        $this->class = $class;
27
        $this->property = $property;
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function matches($object, $property)
34
    {
35
        return ($object instanceof $this->class) && ($property == $this->property);
36
    }
37
}
38