html; } public function setBeforePrintCell(\Closure $closure): void { $this->beforePrintCell = $closure; } public function getCustomCell(string $key, string $cell) { if (is_array($this->beforePrintCell)) { foreach ($this->beforePrintCell as $currentKey => $closure) { if ($key == $currentKey) { $hook = $closure; $cell = $hook($cell); } } } else { $hook = $this->beforePrintCell; $cell = $hook($key, $cell); } return $cell; } public function afterPrint(\Closure $closure): void { $this->afterPrintHook = $closure; } public function beforePrint(\Closure $closure): void { $this->beforePrintHook = $closure; } }