public function hasExtension($class)
    {
        $class = ltrim($class, '\\');
        if (!isset($this->extensionsByClass[$class]) && class_exists($class, false)) {
            // For BC/FC with namespaced aliases
            $class = new ReflectionClass($class);
            $class = $class->name;
        }

        if (isset($this->extensions[$class])) {
            if ($class !== get_class($this->extensions[$class])) {
                @trigger_error(sprintf('Referencing the "%s" extension by its name (defined by getName()) is deprecated since 1.26 and will be removed in Twig 2.0. Use the Fully Qualified Extension Class Name instead.', $class), E_USER_DEPRECATED);
            }

            return true;
        }

        return isset($this->extensionsByClass[$class]);
    }