paginator = $paginator; } /** * Forward all calls to the paginator, stripping callable arguments first. */ public function __call($method, $parameters) { foreach ($parameters as &$param) { $param = $this->stripCallables($param); } unset($param); return $this->forwardCallTo($this->paginator, $method, $parameters); } /** * Recursively null out any callable value at any depth. */ protected function stripCallables($value) { if (is_array($value)) { foreach ($value as $key => $item) { $value[$key] = $this->stripCallables($item); } return $value; } return is_callable($value) ? null : $value; } public function getIterator(): Traversable { return $this->paginator->getIterator(); } public function offsetExists($offset): bool { return $this->paginator->offsetExists($offset); } #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->paginator->offsetGet($offset); } public function offsetSet($offset, $value): void { $this->paginator->offsetSet($offset, $value); } public function offsetUnset($offset): void { $this->paginator->offsetUnset($offset); } public function count(): int { return $this->paginator->count(); } public function __toString(): string { return (string) $this->paginator->render(); } }