for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PiedWeb\LogsAnalyzer;
class LogParser extends \Kassner\LogParser\LogParser
{
protected $domain;
protected $type;
public function setDomain(string $domain)
$this->domain = $domain;
}
public function setType(string $type)
$this->type = $type;
public function parse($line)
if (!preg_match($this->pcreFormat, $line, $matches)) {
throw new \Kassner\LogParser\FormatException($line);
$entry = $this->createEntry();
foreach (array_filter(array_keys($matches), 'is_string') as $key) {
$setter = 'set'.$key;
if (method_exists($entry, $setter)) {
$entry->$setter($matches[$key]);
return $entry;
/**
* @return LogLine
*/
protected function createEntry()
return null === $this->type ? new LogLine($this->domain) : new $this->type($this->domain);