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/Frame/Ansi.php
2019-07-12 10:42:01 +07:00

41 lines
948 B
PHP

<?php
namespace App\Classes\Frame;
use App\Classes\Parser;
use Illuminate\Support\Facades\Log;
use App\Classes\Frame;
use App\Classes\Parser\Ansi as AnsiParser;
use App\Models\Frame as FrameModel;
class Ansi extends Frame
{
public static $frame_length = 22;
public static $frame_width = 80;
public static $header_length = 58;
public static $pagenum_length = 11;
public static $cost_length = 7;
public static $cost_unit = 'u';
public static $if_filler = '.';
public function __construct(FrameModel $o,string $msg='')
{
parent::__construct($o);
// If we have a message to display on the bottom line.
if ($msg)
$this->output .= ESC.'[24;0f'.$msg.HOME;
}
protected function parser(int $startline): Parser
{
return new AnsiParser($this->fo->content,self::$frame_width,$startline);
}
public static function strlenv($text):int {
return strlen($text ? preg_replace('/'.ESC.'\[[0-9;?]+[a-zA-Z]/','',$text) : $text);
}
}