<commit_before><?php

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

namespace Sorien\DataGridBundle\Grid\Column;

use Sorien\DataGridBundle\Grid\Filter;

class SelectColumn extends Column
{
    const BLANK = '_default';

    protected $values;

    public function __initialize(array $params)
    {
        parent::__initialize($params);
        $this->values = $this->getParam('values', array());
    }

    public function setData($data)
    {
        if ((is_string($data) || is_integer($data)) && $data != $this::BLANK && key_exists($data, $this->values))
        {
            $this->data = $data;
        }

        return $this;
    }

    public function getFilters()
    {
        return array(new Filter(self::OPERATOR_EQ, '\''.$this->data.'\''));
    }

    public function getValues()
    {
        return $this->values;
    }

    public function renderCell($value, $row, $router)
    {
        if (key_exists((string)$value, $this->values))
        {
            $value = $this->values[$value];
        }
        return parent::renderCell($value, $row, $router);
    }

    public function getType()
    {
        return 'select';
    }
}
<commit_msg>Fix bug #124.2<commit_after><?php

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

namespace Sorien\DataGridBundle\Grid\Column;

use Sorien\DataGridBundle\Grid\Filter;

class SelectColumn extends Column
{
    const BLANK = '_default';

    protected $values;

    public function __initialize(array $params)
    {
        parent::__initialize($params);
        $this->values = $this->getParam('values', array());
    }

    public function setData($data)
    {
        if ((is_string($data) || is_integer($data)) && $data != $this::BLANK && key_exists($data, $this->values))
        {
            $this->data = $data;
        }

        return $this;
    }

    public function getFilters()
    {
        return array(new Filter(self::OPERATOR_EQ, $this->data));
    }

    public function getValues()
    {
        return $this->values;
    }

    public function renderCell($value, $row, $router)
    {
        if (key_exists((string)$value, $this->values))
        {
            $value = $this->values[$value];
        }
        return parent::renderCell($value, $row, $router);
    }

    public function getType()
    {
        return 'select';
    }
}

{'fraction_non_alphanumeric': 0.1423728813559322, 'fraction_numerical': 0.0015065913370998117, 'mean_word_length': 2.4673629242819843, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 25, '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': '4304414', 'n_tokens_mistral': 803, 'n_tokens_neox': 784, 'n_words': 194}