You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
629 B
38 lines
629 B
<?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; |
|
} |
|
} |