mirror of
https://github.com/notf0und/SGS
synced 2026-07-18 02:31:08 +00:00
Initial commit / First Release
This commit is contained in:
parent
2e8f5ce028
commit
2579f561c3
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
enum NintendoFileExtension: string
|
||||
{
|
||||
case NSP = 'nsp';
|
||||
case NSZ = 'nsz';
|
||||
case XCI = 'xci';
|
||||
case XCZ = 'xcz';
|
||||
|
||||
/**
|
||||
* Get all supported file extensions.
|
||||
*
|
||||
* @return array<string>
|
||||
*/
|
||||
public static function values(): array
|
||||
{
|
||||
return array_map(fn($case) => $case->value, self::cases());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a filename has a supported extension.
|
||||
*/
|
||||
public static function isSupported(string $filename): bool
|
||||
{
|
||||
$extension = Str::lower(Str::afterLast($filename, '.'));
|
||||
|
||||
return in_array($extension, self::values(), true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user