column format
This commit is contained in:
@ -23,11 +23,23 @@ class JasonTable
|
||||
public function getCustomCell(string $key, string|null $cell)
|
||||
{
|
||||
if (is_array($this->beforePrintCell)) {
|
||||
foreach ($this->beforePrintCell as $currentKey => $closure) {
|
||||
if ($key == $currentKey) {
|
||||
$hook = $closure;
|
||||
if (isset($this->beforePrintCell[$key])) {
|
||||
if (is_array($this->beforePrintCell[$key])){
|
||||
if (isset($this->beforePrintCell[$key]['value'])){
|
||||
$hook = $this->beforePrintCell[$key]['value'];
|
||||
$cell = $hook($cell);
|
||||
}
|
||||
elseif (isset($this->beforePrintCell[$key]['format'])){
|
||||
$format = explode(":", $this->beforePrintCell[$key]['format']);
|
||||
$formatClass = FormatMapper::getFormat()[$format[0]];
|
||||
$cell = $formatClass::fetch($cell, $format[1] ?? null);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$hook = $this->beforePrintCell[$key];
|
||||
$cell = $hook($cell);
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
$hook = $this->beforePrintCell;
|
||||
|
Reference in New Issue
Block a user