<commit_before><?php

/*
 * This file is part of the DataGridBundle.
 *
 * (c) Abhoryo <<EMAIL>>
 * (c) <NAME>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace APY\DataGridBundle\Twig;

use APY\DataGridBundle\Grid\Grid;
use Pagerfanta\Pagerfanta;
use Pagerfanta\Adapter\NullAdapter;

class DataGridExtension extends \Twig_Extension
{
    const DEFAULT_TEMPLATE = 'APYDataGridBundle::blocks.html.twig';

    /**
     * @var \Twig_Environment
     */
    protected $environment;

    /**
     * @var \Twig_TemplateInterface[]
     */
    protected $templates = array();

    /**
     * @var string
     */
    protected $theme;

    /**
    * @var \Symfony\Component\Routing\Router
    */
    protected $router;

    /**
     * @var array
     */
    protected $names;

    /**
     * @var array
     */
    protected $params = array();
    
    /**
     * 
     * @var array
     */
    protected $pagerFantaDefs;
    
    public function __construct($router)
    {
        $this->router = $router;
    }
    
    public function setPagerFanta(array $def)
    {
        $this->pagerFantaDefs=$def;
    }
    
    public function initRuntime(\Twig_Environment $environment)
    {
        $this->environment = $environment;

        // Avoids the exception "Variable does not exist" with the _self template
        $globals = $this->environment->getGlobals();

        if (!isset($globals['grid'])) {
            $this->environment->addGlobal('grid', null);
        }

        if (!isset($globals['column'])) {
            $this->environment->addGlobal('column', null);
        }

        if (!isset($globals['row'])) {
            $this->environment->addGlobal('row', null);
        }

        if (!isset($globals['value'])) {
            $this->environment->addGlobal('value', null);
        }

        if (!isset($globals['submitOnChange'])) {
            $this->environment->addGlobal('submitOnChange', null);
        }
    }

    /**
     * Returns a list of functions to add to the existing list.<commit_msg>Commented out global Twig var (quickfix)<commit_after><?php

/*
 * This file is part of the DataGridBundle.
 *
 * (c) Abhoryo <<EMAIL>>
 * (c) <NAME>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace APY\DataGridBundle\Twig;

use APY\DataGridBundle\Grid\Grid;
use Pagerfanta\Pagerfanta;
use Pagerfanta\Adapter\NullAdapter;

class DataGridExtension extends \Twig_Extension
{
    const DEFAULT_TEMPLATE = 'APYDataGridBundle::blocks.html.twig';

    /**
     * @var \Twig_Environment
     */
    protected $environment;

    /**
     * @var \Twig_TemplateInterface[]
     */
    protected $templates = array();

    /**
     * @var string
     */
    protected $theme;

    /**
    * @var \Symfony\Component\Routing\Router
    */
    protected $router;

    /**
     * @var array
     */
    protected $names;

    /**
     * @var array
     */
    protected $params = array();
    
    /**
     * 
     * @var array
     */
    protected $pagerFantaDefs;
    
    public function __construct($router)
    {
        $this->router = $router;
    }
    
    public function setPagerFanta(array $def)
    {
        $this->pagerFantaDefs=$def;
    }
    
    public function initRuntime(\Twig_Environment $environment)
    {
        $this->environment = $environment;

        // Avoids the exception "Variable does not exist" with the _self template
        $globals = $this->environment->getGlobals();

        if (!isset($globals['grid'])) {
            //$this->environment->addGlobal('grid', null);
        }

        if (!isset($globals['column'])) {
            $this->environment->addGlobal('column', null);
        }

        if (!isset($globals['row'])) {
            $this->environment->addGlobal('row', null);
        }

        if (!isset($globals['value'])) {
            $this->environment->addGlobal('value', null);
        }

        if (!isset($globals['submitOnChange'])) {
            $this->environment->addGlobal('submitOnChange', null);
        }
    }

    /**
     * Returns a list of functions to add to the existing list.
{'fraction_non_alphanumeric': 0.14093801555503183, 'fraction_numerical': 0.0, 'mean_word_length': 2.2347560975609757, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '783327', 'n_tokens_mistral': 1275, 'n_tokens_neox': 1249, 'n_words': 278}