Reverse order and multiple log files handler
This commit is contained in:
27
app/common/Implement/Parser.php
Normal file
27
app/common/Implement/Parser.php
Normal 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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user