public function addFileFormat(string $mime_type, $writer_class)
    {
        if (is_string($writer_class))
        {
            if (!class_exists($writer_class) || !(is_subclass_of($writer_class, AbstractWriter::class, $writer_class)))
            {
                throw new InvalidArgumentException(
                    "Class {$writer_class} does not exist or does not implement " . AbstractWriter::class
                );
            }
            $this->file_formats[$mime_type] = $writer_class;    
        }
        elseif ($writer_class instanceof AbstractWriter)
        {
            $this->file_formats[$mime_type] = $writer_class;    
        }
        else
        {
            throw new InvalidArgumentException(
                "Invalid writer specified: " . WF::str($writer_class)
            );
        }

        $this->file_formats[$mime_type] = $writer_class;    
        return $this;
    }
public function addFileFormat(string $mime_type, $writer_class)
    {
        if (is_string($writer_class))
        {
            if (!class_exists($writer_class) || !(is_subclass_of($writer_class, AbstractWriter::class, $writer_class)))
            {
                throw new InvalidArgumentException(
                    "Class {$writer_class} does not exist or does not implement " . AbstractWriter::class
                );
            }
            $this->file_formats[$mime_type] = $writer_class;    
        }
        elseif ($writer_class instanceof AbstractWriter)
        {
            $this->file_formats[$mime_type] = $writer_class;    
        }
        else
        {
            throw new InvalidArgumentException(
                "Invalid writer specified: " . WF::str($writer_class)
            );
        }

        $this->file_formats[$mime_type] = $writer_class;    
        return $this;
    }
public function addFileFormat ( string $ mime_type , $ writer_class ) { if ( is_string ( $ writer_class ) ) { if ( ! class_exists ( $ writer_class ) || ! ( is_subclass_of ( $ writer_class , AbstractWriter :: class , $ writer_class ) ) ) { throw new InvalidArgumentException ( "Class {$writer_class} does not exist or does not implement " . AbstractWriter :: class ) ; } $ this -> file_formats [ $ mime_type ] = $ writer_class ; } elseif ( $ writer_class instanceof AbstractWriter ) { $ this -> file_formats [ $ mime_type ] = $ writer_class ; } else { throw new InvalidArgumentException ( "Invalid writer specified: " . WF :: str ( $ writer_class ) ) ; } $ this -> file_formats [ $ mime_type ] = $ writer_class ; return $ this ; }
Add a file format that this writer can output. This can be used to
add a custom mime-type -> writer mapping. If the format is already
registered, it is overwritten.

@param string $mime_type The mime type to register
@param string $writer_class The writer class. Should subclass AbstractWriter
@return Wedeto\HTTP\DataResponse Provides fluent interface
Add a file format that this writer can output . This can be used to add a custom mime - type - > writer mapping . If the format is already registered it is overwritten .