public static function extendProfiler(
        ContainerInterface $container,
        ?ProfilerContract $profiler = null
    ): ?ProfilerContract {
        if ($profiler !== null) {
            $options = self::resolveOptions($container->get('config'));

            if ($options['collector']['logs'] === true && $container->has(LogManager::class)) {
                $profiler->addCollector(new LoggerDataCollector($container->get(LogManager::class)->getDriver()));
            }
        }

        return $profiler;
    }