src/Environaut/Export/Export.php
protected function getFormatterByExtension($location)
    {
        $ext = pathinfo($location, PATHINFO_EXTENSION);

        $formatter = null;

        switch ($ext) {
            case 'json':
                $formatter = 'Environaut\Export\Formatter\JsonSettingsWriter';
                break;
            case 'xml':
                $formatter = 'Environaut\Export\Formatter\XmlSettingsWriter';
                break;
            case 'php':
                $formatter = 'Environaut\Export\Formatter\PhpSettingsWriter';
                break;
            case 'sh':
                $formatter = 'Environaut\Export\Formatter\ShellSettingsWriter';
                break;
            case 'txt':
            default:
                $formatter = 'Environaut\Export\Formatter\PlainTextSettingsWriter';
        }

        return $formatter;
    }
protected function getFormatterByExtension($location)
    {
        $ext = pathinfo($location, PATHINFO_EXTENSION);

        $formatter = null;

        switch ($ext) {
            case 'json':
                $formatter = 'Environaut\Export\Formatter\JsonSettingsWriter';
                break;
            case 'xml':
                $formatter = 'Environaut\Export\Formatter\XmlSettingsWriter';
                break;
            case 'php':
                $formatter = 'Environaut\Export\Formatter\PhpSettingsWriter';
                break;
            case 'sh':
                $formatter = 'Environaut\Export\Formatter\ShellSettingsWriter';
                break;
            case 'txt':
            default:
                $formatter = 'Environaut\Export\Formatter\PlainTextSettingsWriter';
        }

        return $formatter;
    }
Returns a specific formatter instance depending on the file
extension of the given export file location.

@param string $location

@return IReportFormatter

@throws \InvalidArgumentException in case of unsupported file extensions