annotate vendor/myclabs/deep-copy/src/DeepCopy/Matcher/PropertyMatcher.php @ 2:5311817fb629

Theme updates
author Chris Cannam
date Tue, 10 Jul 2018 13:19:18 +0000
parents
children
rev   line source
Chris@2 1 <?php
Chris@2 2
Chris@2 3 namespace DeepCopy\Matcher;
Chris@2 4
Chris@2 5 /**
Chris@2 6 * @final
Chris@2 7 */
Chris@2 8 class PropertyMatcher implements Matcher
Chris@2 9 {
Chris@2 10 /**
Chris@2 11 * @var string
Chris@2 12 */
Chris@2 13 private $class;
Chris@2 14
Chris@2 15 /**
Chris@2 16 * @var string
Chris@2 17 */
Chris@2 18 private $property;
Chris@2 19
Chris@2 20 /**
Chris@2 21 * @param string $class Class name
Chris@2 22 * @param string $property Property name
Chris@2 23 */
Chris@2 24 public function __construct($class, $property)
Chris@2 25 {
Chris@2 26 $this->class = $class;
Chris@2 27 $this->property = $property;
Chris@2 28 }
Chris@2 29
Chris@2 30 /**
Chris@2 31 * Matches a specific property of a specific class.
Chris@2 32 *
Chris@2 33 * {@inheritdoc}
Chris@2 34 */
Chris@2 35 public function matches($object, $property)
Chris@2 36 {
Chris@2 37 return ($object instanceof $this->class) && $property == $this->property;
Chris@2 38 }
Chris@2 39 }