public static function create(int $type, int $itemsPerPage = 20, array $csvProperties = []): Exporter
    {
        if ($itemsPerPage < 1) {
            throw new InvalidArgumentException('At least one item must be exported per page.');
        }

        switch ($type) {
            case self::TYPE_XML:
                $exporter = new XMLExporter($itemsPerPage);
                break;
            case self::TYPE_CSV:
                $exporter = new CSVExporter($itemsPerPage, $csvProperties);
                break;
            default:
                throw new InvalidArgumentException('Unsupported exporter type.');
        }

        return $exporter;
    }
public static function create(int $type, int $itemsPerPage = 20, array $csvProperties = []): Exporter
    {
        if ($itemsPerPage < 1) {
            throw new InvalidArgumentException('At least one item must be exported per page.');
        }

        switch ($type) {
            case self::TYPE_XML:
                $exporter = new XMLExporter($itemsPerPage);
                break;
            case self::TYPE_CSV:
                $exporter = new CSVExporter($itemsPerPage, $csvProperties);
                break;
            default:
                throw new InvalidArgumentException('Unsupported exporter type.');
        }

        return $exporter;
    }
public static function create ( int $ type , int $ itemsPerPage = 20 , array $ csvProperties = [ ] ) : Exporter { if ( $ itemsPerPage < 1 ) { throw new InvalidArgumentException ( 'At least one item must be exported per page.' ) ; } switch ( $ type ) { case self :: TYPE_XML : $ exporter = new XMLExporter ( $ itemsPerPage ) ; break ; case self :: TYPE_CSV : $ exporter = new CSVExporter ( $ itemsPerPage , $ csvProperties ) ; break ; default : throw new InvalidArgumentException ( 'Unsupported exporter type.' ) ; } return $ exporter ; }
Creates an exporter for the desired output format.

@param int $type The type of export format to choose. Must be either Exporter::TYPE_XML or Exporter::TYPE_CSV.
@param int $itemsPerPage Number of items being exported at once. Respecting this parameter is at the exporter
implementation's discretion.
@param array $csvProperties Properties/extra columns for CSV export. Has no effect for XML export.
@return Exporter The exporter for the desired output format.
Creates an exporter for the desired output format .