Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace DeepCopy\Matcher;
4
 
5
/**
6
 * @final
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
     * Matches a specific property of a specific class.
32
     *
33
     * {@inheritdoc}
34
     */
35
    public function matches($object, $property)
36
    {
37
        return ($object instanceof $this->class) && $property == $this->property;
38
    }
39
}