Skip to content

Commit

Permalink
add file ext parser
Browse files Browse the repository at this point in the history
  • Loading branch information
kiss291323003 committed Jan 8, 2024
1 parent 83dee56 commit 5920992
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit 5920992

Please sign in to comment.