<commit_before><?php
namespace PTS\DataTransformer;

use PTS\DataTransformer\Types;

class TypeConverter
{
    /** @var Types\BaseType[] */
    protected $types;

    public function __construct()
    {
        $this->types = [
            'proxy' => new Types\BaseType,
            'string' => new Types\StringType,
            'int' => new Types\IntType,
            'array' => new Types\ArrayType,
            'date' => new Types\DateType,
            'float' => new Types\FloatType,
            'bool' => new Types\BoolType,
            'refModels' => new Types\RefModelsType,
            'refModel' => new Types\RefModelType,
        ];
    }

    /**
     * @param string $name
     * @param Types\BaseType $type
     * @return $this
     */
    public function addType($name, Types\BaseType $type)
    {
        $this->types[$name] = $type;
        return $this;
    }

    /**
     * @return Types\BaseType[]
     */
    public function getTypes()
    {
        return $this->types;
    }

    /**
     * @param mixed $val
     * @param array $prop
     * @return mixed
     */
    public function toData($val, array $prop)
    {
        return $this->types[$prop['type']]->toData($val);
    }

    /**
     * @param mixed $val
     * @param array $prop
     * @return mixed
     */
    public function toModel($val, array $prop)
    {
        return $this->types[$prop['type']]->toModel($val);
    }
}<commit_msg>fix code style<commit_after><?php
namespace PTS\DataTransformer;

use PTS\DataTransformer\Types;

class TypeConverter
{
    /** @var Types\BaseType[] */
    protected $types;

    public function __construct()
    {
        $this->types = [
            'proxy' => new Types\BaseType,
            'string' => new Types\StringType,
            'int' => new Types\IntType,
            'array' => new Types\ArrayType,
            'date' => new Types\DateType,
            'float' => new Types\FloatType,
            'bool' => new Types\BoolType,
            'refModels' => new Types\RefModelsType,
            'refModel' => new Types\RefModelType
        ];
    }

    /**
     * @param string $name
     * @param Types\BaseType $type
     * @return $this
     */
    public function addType($name, Types\BaseType $type)
    {
        $this->types[$name] = $type;
        return $this;
    }

    /**
     * @return Types\BaseType[]
     */
    public function getTypes()
    {
        return $this->types;
    }

    /**
     * @param mixed $val
     * @param array $prop
     * @return mixed
     */
    public function toData($val, array $prop)
    {
        return $this->types[$prop['type']]->toData($val);
    }

    /**
     * @param mixed $val
     * @param array $prop
     * @return mixed
     */
    public function toModel($val, array $prop)
    {
        return $this->types[$prop['type']]->toModel($val);
    }
}
{'fraction_non_alphanumeric': 0.14873417721518986, 'fraction_numerical': 0.0, 'mean_word_length': 1.847847847847848, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, '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': '7237261', 'n_tokens_mistral': 876, 'n_tokens_neox': 868, 'n_words': 194}