<commit_before><?php

namespace Faker\ORM\CakePHP;

class ColumnTypeGuesser
{
    protected $generator;

    public function __construct(\Faker\Generator $generator)
    {
        $this->generator = $generator;
    }

    public function guessFormat($column, $table)
    {
        $generator = $this->generator;
        $schema = $table->schema();

        switch ($schema->columnType($column)) {
            case 'boolean':
                return function() use ($generator) {
                    return $generator->boolean;
                };
            case 'integer':
                return function() {
                    return mt_rand(0, intval('2147483647'));
                };
            case 'biginteger':
                return function() {
                    return mt_rand(0, intval('18446744073709551615'));
                };
            case 'decimal':
            case 'float':
                return function() {
                    return mt_rand(0, intval('4294967295')) / mt_rand(1, intval('4294967295'));
                };
            case 'uuid':
                return function() {
                    return \Cake\Utility\String::uuid();
                };
            case 'string':
                $columnData = $schema->column($column);
                $length = $columnData['length'];<commit_msg>Use built-in formatters<commit_after><?php

namespace Faker\ORM\CakePHP;

class ColumnTypeGuesser
{
    protected $generator;

    public function __construct(\Faker\Generator $generator)
    {
        $this->generator = $generator;
    }

    public function guessFormat($column, $table)
    {
        $generator = $this->generator;
        $schema = $table->schema();

        switch ($schema->columnType($column)) {
            case 'boolean':
                return function() use ($generator) {
                    return $generator->boolean;
                };
            case 'integer':
                return function() use ($generator) {
                    return $generator->randomNumber(10);
                };
            case 'biginteger':
                return function() use ($generator) {
                    return $generator->randomNumber(20);
                };
            case 'decimal':
            case 'float':
                return function() use ($generator) {
                    return $generator->randomFloat();
                };
            case 'uuid':
                return function() use ($generator) {
                    return $generator->uuid();
                };
            case 'string':
                $columnData = $schema->column($column);
                $length = $columnData['length'];
{'fraction_non_alphanumeric': 0.12097378277153559, 'fraction_numerical': 0.021722846441947566, 'mean_word_length': 1.4640221402214022, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '4881898', 'n_tokens_mistral': 692, 'n_tokens_neox': 625, 'n_words': 140}