mirror of
https://github.com/YGGverse/yo-tools-php.git
synced 2025-02-06 12:04:24 +00:00
init Snap class
This commit is contained in:
parent
577cf83f6f
commit
3622e0d67f
38
src/Snap.php
Normal file
38
src/Snap.php
Normal 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;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user