diff --git a/src/File.php b/src/File.php index 05c3dc8..ecc1394 100644 --- a/src/File.php +++ b/src/File.php @@ -243,4 +243,18 @@ static function scanDirectory($dirPath) return [ 'files' => $fileContainer, 'dirs' => $dirContainer ]; } + + + static function getExt(string $file,bool $withDot = false):?string + { + $list = explode(".",$file); + if(count($list) < 2){ + return null; + } + $ext = array_pop($list); + if($withDot){ + return '.'.$ext; + } + return $ext; + } } \ No newline at end of file