<commit_before><?php
namespace Lazy\Schema\SchemaDeclare;

use Exception;

class Column 
{
    const  attr_any = 0;
    const  attr_array = 1;
    const  attr_string = 2;
    const  attr_integer = 3;
    const  attr_float = 4;
    const  attr_callable = 5;
    const  attr_flag = 6;

    /**
     * @var string column name
     */
    public $name;
    public $supportedAttributes = array();
    public $attributes = array();

    public function __construct( $name )
    {
        $this->name = $name;
        $this->supportedAttributes = array(

            'primary' => self::attr_flag,

            'autoIncrement' => self::attr_flag,

            'immutable' => self::attr_flag,

            /* unique, should support by SQL syntax */
            'unique' => self::attr_flag,

            'null' => self::attr_flag,

            'notNull' => self::attr_flag,

            'required' => self::attr_flag,


            /* column label */
            'label' => self::attr_string,
            'desc'  => self::attr_string,
            'comment'  => self::attr_string,


            /* reference to model schema */
            'refer' => self::attr_string,


            /* data type: string, integer, DateTime, classname */
            'isa' => self::attr_string,

            'type' => self::attr_string,

            'default' => self::attr_any,

            'defaultBuilder' => self::attr_callable,

            'validator'  => self::attr_callable,

            'validValueBuilder' => self::attr_callable,


			// canonicalizer
			'canonicalizer' => self::attr_callable,

			// an alias of canonicalizer
			'filter' => self::attr_callable,
        );
    }

    public function varchar($size)
    {
        $this->attributes[ 'type' ] = 'varchar(' . $size . ')';
		$this->attributes[ 'isa' ]  = 'str';
        return $this;
    }

    public function timestamp()
    {
        $this->type = 'timestamp';
        $this->isa = 'DateTime';
        return $this;
    }

    public function text()
    {
        $this->type = 'text';
		$this->attributes[ 'isa' ]  = 'str';
        return $this;
    }

    public function integer()
    {
        $this->type = 'integer';
		$this->attributes[ 'isa' ]  = 'int';
        return $this;
    }

    public function boolean()
    {
        $this->type = 'boolean';
        $this->isa = 'bool';
        return $this;
    }

    public function blob()
    {
        $this->type = 'blob';
        return $this;
    }

    public function binary()
    {
        $this->type = 'binary';
        return $this;
    }

    public function datetime()
    {
        $this->type = 'datetime';
        $this->isa = 'DateTime';
        return $this;
    }


    public function autoIncrement()
    {<commit_msg>default isa<commit_after><?php
namespace Lazy\Schema\SchemaDeclare;

use Exception;

class Column 
{
    const  attr_any = 0;
    const  attr_array = 1;
    const  attr_string = 2;
    const  attr_integer = 3;
    const  attr_float = 4;
    const  attr_callable = 5;
    const  attr_flag = 6;

    /**
     * @var string column name
     */
    public $name;
    public $supportedAttributes = array();
    public $attributes = array();

    public function __construct( $name )
    {
        $this->name = $name;
        $this->supportedAttributes = array(

            'primary' => self::attr_flag,

            'autoIncrement' => self::attr_flag,

            'immutable' => self::attr_flag,

            /* unique, should support by SQL syntax */
            'unique' => self::attr_flag,

            'null' => self::attr_flag,

            'notNull' => self::attr_flag,

            'required' => self::attr_flag,


            /* column label */
            'label' => self::attr_string,
            'desc'  => self::attr_string,
            'comment'  => self::attr_string,


            /* reference to model schema */
            'refer' => self::attr_string,


            /* data type: string, integer, DateTime, classname */
            'isa' => self::attr_string,

            'type' => self::attr_string,

            'default' => self::attr_any,

            'defaultBuilder' => self::attr_callable,

            'validator'  => self::attr_callable,

            'validValueBuilder' => self::attr_callable,


			// canonicalizer
			'canonicalizer' => self::attr_callable,

			// an alias of canonicalizer
			'filter' => self::attr_callable,
        );
    }

    public function varchar($size)
    {
        $this->attributes[ 'type' ] = 'varchar(' . $size . ')';
		$this->attributes[ 'isa' ]  = 'str';
        return $this;
    }

    public function timestamp()
    {
        $this->type = 'timestamp';
        $this->isa = 'DateTime';
        return $this;
    }

    public function text()
    {
        $this->type = 'text';
		$this->attributes[ 'isa' ]  = 'str';
        return $this;
    }

    public function integer()
    {
        $this->type = 'integer';
		$this->attributes[ 'isa' ]  = 'int';
        return $this;
    }

    public function boolean()
    {
        $this->type = 'boolean';
        $this->isa = 'bool';
        return $this;
    }

    public function blob()
    {
        $this->type = 'blob';
        $this->isa = 'str';
        return $this;
    }

    public function binary()
    {
        $this->type = 'binary';
        $this->isa = 'str';
        return $this;
    }

    public function datetime()
    {
        $this->type = 'datetime';
        $this->isa = 'DateTime';
        return $this;
    }


    public function autoIncrement()
    {
{'fraction_non_alphanumeric': 0.14414739884393063, 'fraction_numerical': 0.0025289017341040463, 'mean_word_length': 1.8192464358452138, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 75, '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': '1775141', 'n_tokens_mistral': 1735, 'n_tokens_neox': 1642, 'n_words': 375}