Provides the ability to get constants from instances as well as class/global constants.
string $constant The name of the constant:
null|object $object The object to get the constant from:
string
function twig_constant($constant, $object = null) {
if (null !== $object) {
$constant = get_class($object) . '::' . $constant;
}
return constant($constant);
}