some fix
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
|
||||
namespace Itguild\Tables;
|
||||
|
||||
abstract class JasonTable
|
||||
class JasonTable
|
||||
{
|
||||
protected string $html = "";
|
||||
protected \Closure|array|false $beforePrintCell;
|
||||
@ -15,37 +15,26 @@ abstract class JasonTable
|
||||
echo $this->html;
|
||||
}
|
||||
|
||||
// public function setBeforePrintCell(\Closure $closure): void
|
||||
// {
|
||||
// $this->beforePrintCell = $closure;
|
||||
// }
|
||||
|
||||
public function setBeforePrintCell(\Closure|array $data): void
|
||||
public function setBeforePrintCell(\Closure $closure): void
|
||||
{
|
||||
if(is_array($data)) {
|
||||
foreach ($data as $key => $value) {
|
||||
$this->beforePrintCell[$key] = $value;
|
||||
}
|
||||
} else {
|
||||
$this->beforePrintCell = $data;
|
||||
}
|
||||
$this->beforePrintCell = $closure;
|
||||
}
|
||||
|
||||
public function getCustomCeil(string $key, string $ceil)
|
||||
public function getCustomCell(string $key, string $cell)
|
||||
{
|
||||
if (is_array($this->beforePrintCell)) {
|
||||
foreach ($this->beforePrintCell as $_key => $closure) {
|
||||
if ($key == $_key) {
|
||||
foreach ($this->beforePrintCell as $currentKey => $closure) {
|
||||
if ($key == $currentKey) {
|
||||
$hook = $closure;
|
||||
$ceil = $hook($ceil);
|
||||
$cell = $hook($cell);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$hook = $this->beforePrintCell;
|
||||
$ceil = $hook($key, $ceil);
|
||||
$cell = $hook($key, $cell);
|
||||
}
|
||||
|
||||
return $ceil;
|
||||
return $cell;
|
||||
}
|
||||
|
||||
public function afterPrint(\Closure $closure): void
|
||||
|
Reference in New Issue
Block a user