init Snap class

This commit is contained in:
yggverse 2024-04-03 18:03:14 +03:00
parent 577cf83f6f
commit 3622e0d67f

38
src/Snap.php Normal file
View File

@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
namespace Yggverse\YoTools;
class Snap
{
public static function getTimeLast(array $files): int
{
$time = [];
foreach ($files as $file)
{
if (!str_ends_with($file, '.tar.gz'))
{
continue;
}
$time[] = preg_replace(
'/^([\d]+)\.tar\.gz$/',
'$1',
basename(
$file
)
);
}
if ($time)
{
return max(
$time
);
}
return 0;
}
}