<commit_before><?php
/**
 * Created by PhpStorm.
 * User: Kurraz
 */

namespace app\modules\game\models\game_data\base;


use app\modules\game\helpers\FormatterHelper;

abstract class BaseAttribute extends BaseGameData implements INamedValues
{
    /**
     * @var int
     */
    public $value = 0;
    public $learnRate = 1;

    public function serialize()
    {
        return [
            'value' => $this->value,
            'learnRate' => $this->learnRate,
        ];
    }

    public function unserialize($serialized_data)
    {
        if(isset($serialized_data['value']))
        {
            $this->value = $serialized_data['value'];
        }
    }

    public function getMaxValue()
    {
        return count($this->valueNames()) - 1;
    }

    public function out()
    {
        return FormatterHelper::colorAttribute($this->valueNames()[$this->value], $this->value);
    }
}<commit_msg>fix getMaxValue()<commit_after><?php
/**
 * Created by PhpStorm.
 * User: Kurraz
 */

namespace app\modules\game\models\game_data\base;


use app\modules\game\helpers\FormatterHelper;

abstract class BaseAttribute extends BaseGameData implements INamedValues
{
    /**
     * @var int
     */
    public $value = 0;
    public $learnRate = 1;

    public function serialize()
    {
        return [
            'value' => $this->value,
            'learnRate' => $this->learnRate,
        ];
    }

    public function unserialize($serialized_data)
    {
        if(isset($serialized_data['value']))
        {
            $this->value = $serialized_data['value'];
        }
    }

    public function getMaxValue()
    {
        return max(array_keys($this->valueNames()));
    }

    public function out()
    {
        return FormatterHelper::colorAttribute($this->valueNames()[$this->value], $this->value);
    }
}
{'fraction_non_alphanumeric': 0.1387061403508772, 'fraction_numerical': 0.0027412280701754384, 'mean_word_length': 2.3609576427255985, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3013665', 'n_tokens_mistral': 553, 'n_tokens_neox': 540, 'n_words': 102}