Browse Source

init Snap class

main
yggverse 7 months ago
parent
commit
3622e0d67f
  1. 38
      src/Snap.php

38
src/Snap.php

@ -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;
}
}
Loading…
Cancel
Save