Updated Videotex frame to use Parser

This commit is contained in:
Deon George
2018-12-29 23:24:41 +11:00
parent 35b5bc2263
commit 390f52a460
12 changed files with 200 additions and 140 deletions

View File

@@ -4,4 +4,27 @@ 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;
}