public static function getValue($object, $field, $default = null, $accessPrivate = false)
{
if (is_array($object)) {
return Arrays::getValue($object, $field, $default);
}
if (isset($object->{$field})) {
return $object->{$field};
}
if ($accessPrivate) {
$class = new ReflectionObject($object);
if ($class->hasProperty($field)) {
$property = $class->getProperty($field);
$property->setAccessible(true);
return $property->getValue($object);
}
}
return $default;
}