This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
vbbs/app/Classes/Parser.php
2018-12-29 23:24:41 +11:00

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;
}