<commit_before><?php

namespace Kunstmaan\AdminBundle\Twig\Extension;

use Kunstmaan\AdminBundle\Helper\Security\Acl\Permission\PermissionAdmin;

class AdminPermissionsTwigExtension extends \Twig_Extension
{
    /* @var \Twig_Environment */
    protected $environment;

    /**
     * Initializes the runtime environment.
     *
     * This is where you can load some file that contains filter functions for instance.
     *
     * @param Twig_Environment $environment The current Twig_Environment instance
     */
    public function initRuntime(\Twig_Environment $environment)
    {
        $this->environment = $environment;
    }

    /**
     * Returns a list of functions to add to the existing list.
     *
     * @return array An array of functions
     */
    public function getFunctions()
    {
        return array(
            'permissionsadmin_widget'  => new \Twig_Function_Method($this, 'renderWidget', array('is_safe' => array('html'))),
        );
    }

    /**
     * @param \Kunstmaan\AdminBundle\Helper\Security\Acl\Permission\PermissionAdmin $permissionAdmin
     * @param Form                                                                  $form
     * @param array                                                                 $parameters
     *
     * @return string
     */
    public function renderWidget(PermissionAdmin $permissionAdmin, Form $form , array $parameters = array())
    {
        $template = $this->environment->loadTemplate("KunstmaanAdminBundle:PermissionsAdminTwigExtension:widget.html.twig");

        return $template->render(array_merge(array(
            'form'              => $form,
            'permissionadmin'   => $permissionAdmin,
            'recursiveSupport'  => true
        ), $parameters));
    }

    /**<commit_msg>twig extension type hint<commit_after><?php

namespace Kunstmaan\AdminBundle\Twig\Extension;

use Kunstmaan\AdminBundle\Helper\Security\Acl\Permission\PermissionAdmin;
use Symfony\Component\Form\FormView;

class AdminPermissionsTwigExtension extends \Twig_Extension
{
    /* @var \Twig_Environment */
    protected $environment;

    /**
     * Initializes the runtime environment.
     *
     * This is where you can load some file that contains filter functions for instance.
     *
     * @param Twig_Environment $environment The current Twig_Environment instance
     */
    public function initRuntime(\Twig_Environment $environment)
    {
        $this->environment = $environment;
    }

    /**
     * Returns a list of functions to add to the existing list.
     *
     * @return array An array of functions
     */
    public function getFunctions()
    {
        return array(
            'permissionsadmin_widget'  => new \Twig_Function_Method($this, 'renderWidget', array('is_safe' => array('html'))),
        );
    }

    /**
     * @param PermissionAdmin $permissionAdmin
     * @param FormView        $form
     * @param array           $parameters
     *
     * @return string
     */
    public function renderWidget(PermissionAdmin $permissionAdmin, FormView $form , array $parameters = array())
    {
        $template = $this->environment->loadTemplate("KunstmaanAdminBundle:PermissionsAdminTwigExtension:widget.html.twig");

        return $template->render(array_merge(array(
            'form'              => $form,
            'permissionadmin'   => $permissionAdmin,
            'recursiveSupport'  => true
        ), $parameters));
    }

    /**
{'fraction_non_alphanumeric': 0.10028901734104047, 'fraction_numerical': 0.0, 'mean_word_length': 2.3601941747572814, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '246854', 'n_tokens_mistral': 886, 'n_tokens_neox': 885, 'n_words': 211}