2018-08-29 06:15:11 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Services;
|
|
|
|
|
2022-07-07 10:45:47 +00:00
|
|
|
use SplFileInfo;
|
|
|
|
|
2021-12-06 16:12:47 +00:00
|
|
|
class Helper
|
2018-08-29 06:15:11 +00:00
|
|
|
{
|
2022-07-07 10:45:47 +00:00
|
|
|
public static function getModifiedTime(string|SplFileInfo $file): int
|
|
|
|
{
|
|
|
|
$file = is_string($file) ? new SplFileInfo($file) : $file;
|
|
|
|
|
|
|
|
// Workaround for #344, where getMTime() fails for certain files with Unicode names on Windows.
|
2022-08-08 16:00:59 +00:00
|
|
|
return attempt(static fn () => $file->getMTime()) ?? time();
|
2022-07-07 10:45:47 +00:00
|
|
|
}
|
2018-08-29 06:15:11 +00:00
|
|
|
}
|