private function isSubjectPropertyAccessible($property, $withValue = false)
{
if (!is_object($this->getWrappedSubject())) {
return false;
}
if (method_exists($this->getWrappedSubject(), $withValue ? '__set' : '__get')) {
return true;
}
if (!property_exists($this->getWrappedSubject(), $property)) {
return false;
}
$propertyReflection = new ReflectionProperty($this->getWrappedSubject(), $property);
return $propertyReflection->isPublic();
}