Internal rework pending editframe

This commit is contained in:
Deon George
2019-07-12 10:42:01 +07:00
parent 4f79a1a997
commit 264747e2f3
14 changed files with 611 additions and 428 deletions

View File

@@ -2,11 +2,22 @@
namespace App\Classes;
/**
* The Frame Parser looks into frames for ESC codes that renders dynamic information
*/
abstract class Parser
{
protected $content = '';
protected $startline = 0;
public $fields = NULL;
// Fields in the frame
public $fields = [];
// Parsed frame, ready to send to client
public $output = '';
// Position array of frame control chars
protected $frame_data = [];
// Position array of frame chars
protected $frame_content = [];
// Magic Fields that are pre-filled
protected $fieldmap = [
@@ -14,17 +25,16 @@ abstract class Parser
'd'=>'%date',
];
public function __construct(string $content,int $startline=1)
public function __construct(string $content,int $width,int $startline=1)
{
$this->content = $content;
$this->startline = $startline;
$this->fields = collect();
$this->output = $this->parse($startline,$content,$width);
}
public function __toString(): string
{
return $this->parse($this->startline);
return $this->output;
}
abstract protected function parse($startline): string;
abstract protected function parse(int $startline,string $content,int $width): string;
}