public static function templateExists(\Twig_Environment $env, $template) {
        try {
            $env->loadTemplate($template);
        } catch(\Twig_Error_Loader $err) {
            return false;
        } catch(\Twig_Error_Syntax $err) {
            return true;
        }

        return true;
    }
public static function templateExists(\Twig_Environment $env, $template) {
        try {
            $env->loadTemplate($template);
        } catch(\Twig_Error_Loader $err) {
            return false;
        } catch(\Twig_Error_Syntax $err) {
            return true;
        }

        return true;
    }
@internal

Check if template path is valid (template exists).

@param \Twig_Environment $env      Twig environment
@param string            $template Template path

@return bool