private static function registerViewExtension(Slim $app, Recaptcha $recaptcha)
    {
        $view = $app->view;
        if (!property_exists($view, 'parserExtensions')) {
            return;
        }

        $originalExtensions = $view->parserExtensions ?: [];
        $class = explode('\\', get_class($view));
        switch(end($class)) {
            case 'Twig':
                $view->parserExtensions = array_merge($originalExtensions, [new TwigExtension($recaptcha)]);
                break;
        }
    }