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

PropertyMatcher   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A matches() 0 4 2
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