| 123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- declare(strict_types=1);
- namespace App\Enum\Export;
- use MyCLabs\Enum\Enum;
- /**
- * Formats de sortie des fichiers exportés
- */
- class ExportFormatEnum extends Enum
- {
- private const PDF ='pdf';
- private const CSV ='csv';
- private const TXT = 'txt';
- private const XLSX = 'xlsx';
- private const XML = 'xml';
- /** @var array */
- protected static array $mimeType = [
- self::PDF => 'application/pdf',
- self::CSV => 'text/csv',
- self::TXT => 'text/plain',
- self::XLSX => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
- self::XML => 'application/xml'
- ];
- /**
- * @param string $formatShortName
- * @return string
- */
- public static function getMimeType($formatShortName)
- {
- if (!isset(static::$mimeType[$formatShortName])) {
- return "Unknown format ($formatShortName)";
- }
- return static::$mimeType[$formatShortName];
- }
- }
|