Improve looks

This commit is contained in:
2023-02-14 22:50:35 -03:00
parent f8dbb1390e
commit 3718c1e0aa
7 changed files with 70 additions and 45 deletions

View File

@ -1,6 +1,8 @@
<?php
namespace ProVM\Common\Service;
use DateTimeImmutable;
use SplFileInfo;
use ProVM\Logview\Log\File;
class Logs
@ -38,7 +40,9 @@ class Logs
}
public function get(string $log_file): File
{
$content = \Safe\file_get_contents(implode(DIRECTORY_SEPARATOR, [$this->getFolder(), $log_file]));
return (new File())->setFilename($log_file)->setContent($content);
$filename = implode(DIRECTORY_SEPARATOR, [$this->getFolder(), $log_file]);
$file_info = new SplFileInfo($filename);
$content = \Safe\file_get_contents($filename);
return (new File())->setFilename($log_file)->setDate((new DateTimeImmutable())->setTimestamp($file_info->getCTime()))->setContent($content);
}
}