public function mapCol(string $table, string $name, string $type, string $len = null): array
    {
        // Try to find by colsName
        $colsName = $this->getColsNameMapping();
        foreach ($colsName as $colRegex => $params) {
            preg_match("/^$colRegex\$/i", $table. '.' . $name, $matches);
            if (!empty($matches)) {
                return $params;
            }
        }

        // Hardcoded types
        if ($type === 'enum') {
            return [
                'method' => 'randomElement',
                'params' => [explode("','", substr($len, 1, -1))]
            ];
        }

        // Try to find by fieldType
        $colsType = $this->getColsTypeMapping($len);
        if (!array_key_exists($type, $colsType)) {
            $msg = "Can't guess the type $type ({$table}.{$name})";
            throw new NeuralyzerGuesserException($msg);
        }

        return $colsType[$type];
    }
public function mapCol(string $table, string $name, string $type, string $len = null): array
    {
        // Try to find by colsName
        $colsName = $this->getColsNameMapping();
        foreach ($colsName as $colRegex => $params) {
            preg_match("/^$colRegex\$/i", $table. '.' . $name, $matches);
            if (!empty($matches)) {
                return $params;
            }
        }

        // Hardcoded types
        if ($type === 'enum') {
            return [
                'method' => 'randomElement',
                'params' => [explode("','", substr($len, 1, -1))]
            ];
        }

        // Try to find by fieldType
        $colsType = $this->getColsTypeMapping($len);
        if (!array_key_exists($type, $colsType)) {
            $msg = "Can't guess the type $type ({$table}.{$name})";
            throw new NeuralyzerGuesserException($msg);
        }

        return $colsType[$type];
    }
public function mapCol ( string $ table , string $ name , string $ type , string $ len = null ) : array { // Try to find by colsName $ colsName = $ this -> getColsNameMapping ( ) ; foreach ( $ colsName as $ colRegex => $ params ) { preg_match ( "/^$colRegex\$/i" , $ table . '.' . $ name , $ matches ) ; if ( ! empty ( $ matches ) ) { return $ params ; } } // Hardcoded types if ( $ type === 'enum' ) { return [ 'method' => 'randomElement' , 'params' => [ explode ( "','" , substr ( $ len , 1 , - 1 ) ) ] ] ; } // Try to find by fieldType $ colsType = $ this -> getColsTypeMapping ( $ len ) ; if ( ! array_key_exists ( $ type , $ colsType ) ) { $ msg = "Can't guess the type $type ({$table}.{$name})" ; throw new NeuralyzerGuesserException ( $ msg ) ; } return $ colsType [ $ type ] ; }
Will map cols first by looking for field name then by looking for field type
if the first returned nothing

@param string $table
@param string $name
@param string $type
@param mixed $len Used to get options from enum (stored in length)

@return array
@throws NeuralyzerGuesserException
Will map cols first by looking for field name then by looking for field type if the first returned nothing