Inpsyde\MultilingualPress\API\WPDBLanguages::extract_field_specifications_from_table PHP Method

extract_field_specifications_from_table() private method

There are a lot more conversion specifications, but we don't need more than telling a string from an int.
private extract_field_specifications_from_table ( Inpsyde\MultilingualPress\Database\Table $table ) : string[]
$table Inpsyde\MultilingualPress\Database\Table Table object.
return string[] The array with column names as keys and the individual printf conversion specification as value.
    private function extract_field_specifications_from_table(Table $table)
    {
        $numeric_types = implode('|', ['BIT', 'DECIMAL', 'DOUBLE', 'FLOAT', 'INT', 'NUMERIC', 'REAL']);
        $schema = $table->schema();
        return array_combine(array_keys($schema), array_map(function ($definition) use($numeric_types) {
            return preg_match('/^\\s*[A-Z]*(' . $numeric_types . ')/', $definition) ? '%d' : '%s';
        }, $schema));
    }