30 lines
539 B
PHP
30 lines
539 B
PHP
<?php
|
|
|
|
namespace App\Classes;
|
|
|
|
abstract class Parser
|
|
{
|
|
protected $content = '';
|
|
protected $startline = 0;
|
|
public $fields = NULL;
|
|
|
|
// Magic Fields that are pre-filled
|
|
protected $fieldmap = [
|
|
'a'=>'address#',
|
|
'd'=>'%date',
|
|
];
|
|
|
|
public function __construct(string $content,int $startline=1)
|
|
{
|
|
$this->content = $content;
|
|
$this->startline = $startline;
|
|
$this->fields = collect();
|
|
}
|
|
|
|
public function __toString(): string
|
|
{
|
|
return $this->parse($this->startline);
|
|
}
|
|
|
|
abstract protected function parse($startline): string;
|
|
} |