31 lines
535 B
PHP
31 lines
535 B
PHP
<?php
|
|
|
|
namespace App\Classes;
|
|
|
|
class FrameFields
|
|
{
|
|
private $fields = [];
|
|
|
|
public function __construct(array $fields)
|
|
{
|
|
$this->fields = $fields;
|
|
}
|
|
|
|
public function __get($key)
|
|
{
|
|
return array_get($this->fields,$key);
|
|
}
|
|
|
|
public function output(string $filler)
|
|
{
|
|
switch ($this->type) {
|
|
case 'd':
|
|
$out = date('D d M H:ia');
|
|
|
|
return substr($out.($this->length > strlen($out) ? str_repeat($filler,$this->length-strlen($out)) : ''),0,$this->length);
|
|
|
|
default:
|
|
return str_repeat($filler,$this->length);
|
|
}
|
|
}
|
|
} |