koel/app/Services/Helper.php

17 lines
394 B
PHP
Raw Normal View History

2018-08-29 06:15:11 +00:00
<?php
namespace App\Services;
use SplFileInfo;
class Helper
2018-08-29 06:15:11 +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();
}
2018-08-29 06:15:11 +00:00
}