factory = Closure::fromCallable($factory); } public function import(string $sourcePath, array $extensions): int { return $this->delegate()->import($sourcePath, $extensions); } public function runWorkerOnce(callable $shouldStop): ?int { return $this->delegate()->runWorkerOnce($shouldStop); } private function delegate(): ConsoleServices { return $this->delegate ??= ($this->factory)(); } }