Cake\Database\Schema\SqliteSchema::_convertColumn PHP Method

_convertColumn() protected method

The returned type will be a type that Cake\Database\Type can handle.
protected _convertColumn ( string $column ) : array
$column string The column type + length
return array Array of column information.
    protected function _convertColumn($column)
    {
        preg_match('/(unsigned)?\\s*([a-z]+)(?:\\(([0-9,]+)\\))?/i', $column, $matches);
        if (empty($matches)) {
            throw new Exception(sprintf('Unable to parse column type from "%s"', $column));
        }
        $unsigned = false;
        if (strtolower($matches[1]) === 'unsigned') {
            $unsigned = true;
        }
        $col = strtolower($matches[2]);
        $length = null;
        if (isset($matches[3])) {
            $length = (int) $matches[3];
        }
        if ($col === 'bigint') {
            return ['type' => 'biginteger', 'length' => $length, 'unsigned' => $unsigned];
        }
        if (strpos($col, 'decimal') !== false) {
            return ['type' => 'decimal', 'length' => null, 'unsigned' => $unsigned];
        }
        if (strpos($col, 'int') !== false) {
            return ['type' => 'integer', 'length' => $length, 'unsigned' => $unsigned];
        }
        if (in_array($col, ['float', 'real', 'double'])) {
            return ['type' => 'float', 'length' => null, 'unsigned' => $unsigned];
        }
        if (strpos($col, 'boolean') !== false) {
            return ['type' => 'boolean', 'length' => null];
        }
        if ($col === 'char' && $length === 36) {
            return ['type' => 'uuid', 'length' => null];
        }
        if ($col === 'char') {
            return ['type' => 'string', 'fixed' => true, 'length' => $length];
        }
        if (strpos($col, 'char') !== false) {
            return ['type' => 'string', 'length' => $length];
        }
        if (in_array($col, ['blob', 'clob'])) {
            return ['type' => 'binary', 'length' => null];
        }
        if (in_array($col, ['date', 'time', 'timestamp', 'datetime'])) {
            return ['type' => $col, 'length' => null];
        }
        return ['type' => 'text', 'length' => null];
    }