//
// Just create simple custom function to determine the class name
// and check is equal to DateTime
//
namespace AppBundleTwig;
use Twig_Extension;
use Twig_SimpleFunction;
class HelperExtension extends Twig_Extension
{
public function getFunctions()
{
return array(
new Twig_SimpleFunction('class', array($this, 'getClassName')),
);
}
public function getClassName($object)
{
if (!is_object($object)) {
return null;
}
return get_class($object);
}
}