public static function set($format, $mime, $definition = [])
    {
        $mime = $mime ? (array) $mime : ['text/html'];

        $definition += [
            'cast'       => true,
            'decode'     => null,
            'encode'     => null,
            'mime'       => $mime,
            'conditions' => []
        ];

        static::$_formats[$format] = $definition;
    }
public static function set($format, $mime, $definition = [])
    {
        $mime = $mime ? (array) $mime : ['text/html'];

        $definition += [
            'cast'       => true,
            'decode'     => null,
            'encode'     => null,
            'mime'       => $mime,
            'conditions' => []
        ];

        static::$_formats[$format] = $definition;
    }
public static function set ( $ format , $ mime , $ definition = [ ] ) { $ mime = $ mime ? ( array ) $ mime : [ 'text/html' ] ; $ definition += [ 'cast' => true , 'decode' => null , 'encode' => null , 'mime' => $ mime , 'conditions' => [ ] ] ; static :: $ _formats [ $ format ] = $ definition ; }
Sets a format definition.

Example of a CSV format definition.

```php
Media::set('csv', ['application/csv'], [
'cast'   => true,
'encode' => function($data, $options = []) {
ob_start();
$out = fopen('php://output', 'w');
foreach ($data as $record) {
fputcsv($out, $record);
}
fclose($out);
return ob_get_clean();
},
'decode' => function($data, $options = []) {
$lines = explode(PHP_EOL, $data);
$array = [];
foreach ($lines as $line) {
$array[] = str_getcsv($line);
}
return $array;
}
]);

@param  string $format     The format to register.
@param  array  $definition The definition array.
Sets a format definition .