private function createColumnDef($dbtype, $nullDefault = false) {
        $column = Db::typeDef($dbtype);

        if ($column === null) {
            throw new \InvalidArgumentException("Unknown type '$dbtype'.", 500);
        }

        if ($column['dbtype'] === 'bool' && in_array($nullDefault, [true, false], true)) {
            // Booleans have a special meaning.
            $column['allowNull'] = false;
            $column['default'] = $nullDefault;
        } elseif ($column['dbtype'] === 'timestamp' && empty($column['default'])) {
            $column['default'] = 'current_timestamp';
        } elseif ($nullDefault === null || $nullDefault === true) {
            $column['allowNull'] = true;
        } elseif ($nullDefault === false) {
            $column['allowNull'] = false;
        } else {
            $column['allowNull'] = false;
            $column['default'] = $nullDefault;
        }

        return $column;
    }
private function createColumnDef($dbtype, $nullDefault = false) {
        $column = Db::typeDef($dbtype);

        if ($column === null) {
            throw new \InvalidArgumentException("Unknown type '$dbtype'.", 500);
        }

        if ($column['dbtype'] === 'bool' && in_array($nullDefault, [true, false], true)) {
            // Booleans have a special meaning.
            $column['allowNull'] = false;
            $column['default'] = $nullDefault;
        } elseif ($column['dbtype'] === 'timestamp' && empty($column['default'])) {
            $column['default'] = 'current_timestamp';
        } elseif ($nullDefault === null || $nullDefault === true) {
            $column['allowNull'] = true;
        } elseif ($nullDefault === false) {
            $column['allowNull'] = false;
        } else {
            $column['allowNull'] = false;
            $column['default'] = $nullDefault;
        }

        return $column;
    }
private function createColumnDef ( $ dbtype , $ nullDefault = false ) { $ column = Db :: typeDef ( $ dbtype ) ; if ( $ column === null ) { throw new \ InvalidArgumentException ( "Unknown type '$dbtype'." , 500 ) ; } if ( $ column [ 'dbtype' ] === 'bool' && in_array ( $ nullDefault , [ true , false ] , true ) ) { // Booleans have a special meaning. $ column [ 'allowNull' ] = false ; $ column [ 'default' ] = $ nullDefault ; } elseif ( $ column [ 'dbtype' ] === 'timestamp' && empty ( $ column [ 'default' ] ) ) { $ column [ 'default' ] = 'current_timestamp' ; } elseif ( $ nullDefault === null || $ nullDefault === true ) { $ column [ 'allowNull' ] = true ; } elseif ( $ nullDefault === false ) { $ column [ 'allowNull' ] = false ; } else { $ column [ 'allowNull' ] = false ; $ column [ 'default' ] = $ nullDefault ; } return $ column ; }
Get an array column def from a structured function call.

@param string $dbtype The database type of the column.
@param mixed $nullDefault Whether or not to allow null or the default value.

null|true
: The column is not required.
false
: The column is required.
Anything else
: The column is required and this is its default.

@return array Returns the column def as an array.
Get an array column def from a structured function call .