App src code

This commit is contained in:
2023-02-14 17:27:01 -03:00
parent ab6c7fa9dd
commit 5eec0d93b0
26 changed files with 525 additions and 0 deletions

44
app/src/Log/File.php Normal file
View File

@ -0,0 +1,44 @@
<?php
namespace ProVM\Logview\Log;
use Generator;
use ProVM\Logview\Log;
class File
{
protected string $filename;
protected string $content;
public function getFilename(): string
{
return $this->filename;
}
public function getContent(): string
{
return $this->content;
}
public function setFilename(string $filename): File
{
$this->filename = $filename;
return $this;
}
public function setContent(string $content): File
{
$this->content = $content;
return $this;
}
public function getLogs(): array
{
$lines = explode(PHP_EOL, $this->getContent());
$logs = [];
foreach ($lines as $line) {
if (trim($line) === '') {
continue;
}
$logs []= Log::parse($line);
}
return array_reverse($logs);
}
}