Reverse order and multiple log files handler

This commit is contained in:
2023-02-15 17:45:23 -03:00
parent 110f37e4f4
commit c29eece81c
16 changed files with 494 additions and 101 deletions

View File

@ -0,0 +1,27 @@
<?php
namespace ProVM\Common\Implement;
use ProVM\Common\Define\Log;
abstract class Parser implements \ProVM\Common\Define\Parser
{
public function total(string $filename): int
{
try {
$fh = \Safe\fopen($filename, 'r');
$cnt = 0;
while(!feof($fh)) {
$line = fgets($fh);
$cnt ++;
}
fclose($fh);
return $cnt;
} catch (\Exception $e) {
return 0;
}
}
public function parse(string $content): Log
{
return new \ProVM\Logview\Log($content);
}
}