<commit_before><?php
/**
 * Particle.
 *
 * @link      http://github.com/particle-php for the canonical source repository
 * @copyright Copyright (c) 2005-2015 Particle (http://particle-php.com)
 * @license   https://github.com/particle-php/Filter/blob/master/LICENSE New BSD License
 */
namespace Particle\Filter\FilterRule;

use Particle\Filter\FilterRule;

/**
 * Class NumberFormat
 *
 * @package Particle\Filter\FilterRule
 */
class NumberFormat extends FilterRule
{
    /**
     * @var int
     */
    protected $decimals;

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

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

    /**
     * Set required params for replacement
     *
     * @param int $decimals
     * @param string $decimalPoint
     * @param string $thousandSeperator
     */
    public function __construct($decimals, $decimalPoint, $thousandSeperator)
    {
        $this->decimals = $decimals;
        $this->decimalPoint = $decimalPoint;
        $this->thousandSeperator = $thousandSeperator;
    }

    /**
     * Format the numbers
     *
     * @param mixed $value
     * @return string
     */
    public function filter($value)
    {
        if (empty($value)) {
            return $value;
        }
        return number_format(floatval($value), $this->decimals, $this->decimalPoint, $this->thousandSeperator);
    }
}
<commit_msg>#32: Added intval to cast the decimals-configuration to int<commit_after><?php
/**
 * Particle.
 *
 * @link      http://github.com/particle-php for the canonical source repository
 * @copyright Copyright (c) 2005-2015 Particle (http://particle-php.com)
 * @license   https://github.com/particle-php/Filter/blob/master/LICENSE New BSD License
 */
namespace Particle\Filter\FilterRule;

use Particle\Filter\FilterRule;

/**
 * Class NumberFormat
 *
 * @package Particle\Filter\FilterRule
 */
class NumberFormat extends FilterRule
{
    /**
     * @var int
     */
    protected $decimals;

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

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

    /**
     * Set required params for replacement
     *
     * @param int $decimals
     * @param string $decimalPoint
     * @param string $thousandSeperator
     */
    public function __construct($decimals, $decimalPoint, $thousandSeperator)
    {
        $this->decimals = intval($decimals);
        $this->decimalPoint = $decimalPoint;
        $this->thousandSeperator = $thousandSeperator;
    }

    /**
     * Format the numbers
     *
     * @param mixed $value
     * @return string
     */
    public function filter($value)
    {
        if (empty($value)) {
            return $value;
        }
        return number_format(floatval($value), $this->decimals, $this->decimalPoint, $this->thousandSeperator);
    }
}

{'fraction_non_alphanumeric': 0.12657784011220197, 'fraction_numerical': 0.006311360448807854, 'mean_word_length': 2.4877750611246943, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 2, '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': '2952816', 'n_tokens_mistral': 908, 'n_tokens_neox': 854, 'n_words': 186}