for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Cascade\Mapper\Field\Reference;
class PropertyReference implements ReferenceInterface
{
/**
* @var string
*/
private $property;
* @param string $property
public function __construct($property)
$this->property = $property;
}
public function getValue($instance)
$property = $this->property;
$className = get_class($instance);
if ($className === 'stdClass') {
return $instance->$property;
return (new \ReflectionProperty($className, $property))->getValue($instance);
public function setValue($instance, $value)
$instance->$property = $value;
} else {
(new \ReflectionProperty($className, $property))->setValue($instance, $value);
return $instance;