Add a data collector to the profiler
@param CollectorInterface $collector
@throws \RuntimeException
16949
public function registerCollector(CollectorInterface $collector)
    {
        if ($collector instanceof StartCollectorInterface) {
            $this->collectors['initial'][$collector->getPath()] = $collector;
        } elseif ($collector instanceof FinalCollectorInterface) {
            $this->collectors['final'][$collector->getPath()] = $collector;
        } elseif ($collector instanceof StreamCollectorInterface) {
            $this->collectors['stream'][$collector->getPath()] = $collector;
        } else {
            throw new \RuntimeException('Collector must be implementation of StartCollectorInterface, '
                . 'FinalCollectorInterface or StreamCollectorInterface Path=' . $collector->getPath());
        }
    }
1269616
public function configureProfiler(ContainerBuilder $container, array $config)
    {
        // Setup the data collector service for Symfony profiler
        $dataCollectorDef = new Definition(PheanstalkDataCollector::class);
        $dataCollectorDef->setPublic(false);
        $dataCollectorDef->addTag('data_collector', ['id' => 'pheanstalk', 'template' => $config['profiler']['template']]);
        $dataCollectorDef->addArgument(new Reference('leezy.pheanstalk.pheanstalk_locator'));

        $container->setDefinition('leezy.pheanstalk.data_collector', $dataCollectorDef);
    }
15213
private function fillFromCollection(
        ParameterDefinitionCollectionInterface $definitionCollection,
        ParameterCollectionInterface $parameters
    ): void {
        foreach ($definitionCollection->getParameterDefinitions() as $name => $definition) {
            $value = null;

            if ($parameters->hasParameter($name)) {
                $parameter = $parameters->getParameter($name);
                if ($parameter->getParameterDefinition()->getType()::getIdentifier() === $definition->getType()::getIdentifier()) {
                    $value = $parameter->getValue();
                    $value = is_object($value) ? clone $value : $value;
                }
            }

            $this->setParameterValue($name, $value);

            if ($definition instanceof CompoundParameterDefinition) {
                $this->fillFromCollection($definition, $parameters);
            }
        }
    }
806682
protected function pushDebugConsole(Structure $collector, Profiler $profiler)
    {
        if (!$this->package->config->get('console.enabled', 1)) {
            return;
        }

        // Prepare CSS
        $style = $this->package->getDir() . '/Resources/asset/css/console/style.css';

        // Prepare Time
        $points = $profiler->getPoints();
        $first  = array_shift($points);
        $last   = array_pop($points);
        $time   = $profiler->getTimeBetween($first->getName(), $last->getName());
        $memory = $profiler->getMemoryBetween($first->getName(), $last->getName());

        $data            = new Data();
        $data->collector = $collector;
        $data->style     = file_get_contents($style);

        // Execute Time
        $data->time   = $time * 1000;
        $data->memory = $memory / 1048576;

        // Queries
        $data->queryTimes       = $collector['database.query.times'] ?: 0;
        $data->queryTotalTime   = $collector['database.query.total.time'] * 1000;
        $data->queryTotalMemory = $collector['database.query.total.memory'] / 1048576;

        // Messages
        $data->messages      = (array) $collector['request.session._flash'];
        $data->debugMessages = (array) $collector['debug.messages'];
        $data->messagesCount = [
            'messages' => count(Arr::flatten($data->messages)),
            'debug' => count($data->debugMessages),
        ];

        $data->timeStyle   = TimelineHelper::getStateColor($data->time, 250);
        $data->memoryStyle = TimelineHelper::getStateColor($data->memory, 5);

        $widget = new Widget('debugger.console', 'php', $this->package->getName());

        echo $widget->render($data);
    }
787499
public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition('profiler') || !$container->hasDefinition('twig')) {
            return;
        }

        $container->register('contentful.delivery.profiler_controller', ProfilerController::class)
            ->setArguments([
                new Reference('profiler'),
                new Reference('twig'),
            ])
            ->setPublic(\true)
            ->addTag('controller.service_arguments')
        ;
    }
655002
public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition($this->collectionServiceId)) {
            return;
        }

        $collection = $this->getCollection($container);

        foreach ($container->findTaggedServiceIds($this->serviceTag) as $id => $attributes) {
            $this->addServiceToCollection($collection, $id);
        }
    }
138880
private function initAdmingeneratorClassLoader(ContainerInterface $container)
    {
        if (!$this->classLoaderInitialized) {
            $this->classLoaderInitialized = true;

            $AdmingeneratedClassLoader = new AdmingeneratedClassLoader();
            $AdmingeneratedClassLoader->setBasePath($container->getParameter('kernel.cache_dir'));
            $AdmingeneratedClassLoader->register();
        }
    }
863670
public function addCollectors(array $collectors) {
		foreach ($collectors as $name => $collector) {
			if (is_string($name)) {
				$this->addCollector($collector, $name);
			} else {
				$this->addCollector($collector);
			}
		}
		
		return $this;
	}
992173
protected final void addDataCollector(final Class collectorName) {
		if (!DataCollector.class.isAssignableFrom(collectorName)) {
			throw new RuntimeException("Class must be subclass of DataCollector!");
		}
		collectors.add(collectorName);
	}
825373
public function addItem(ItemInterface $item)
    {
        if ($this->hasItem($item->getId()) === true) {
            throw new \RuntimeException(sprintf('A previous item exists with the same id: "%s".', $item->getId()));
        }

        $this->items[$item->getId()] = $item;
    }
342659
public function onAfterRespond(Event $event)
    {
        /**
         * @var Container $container
         * @var Collector $collector
         * @var Profiler  $profiler
         */
        $container = $event['app']->getContainer();
        $collector = $container->get('debugger.collector');
        $profiler  = $container->get('profiler');

        $profiler->mark(__FUNCTION__, [
            'tag' => 'system.process',
        ]);
    }
150482
public function createLogCollector(LogCollectorSettings $collector)
    {
        $url = self::makeUrl();
        $jsonData = json_encode($collector->jsonSerialize());
        
        $result = $this->service->prepAndSend($url, array(200), "POST", $jsonData, true);
        $resultObject = json_decode($result);
        return LogCollectorSettings::createFromJSON($resultObject);
    }
8602
private function setTenant(?TenantInterface $tenant, ?TokenStorageInterface $tokenStorage): void
    {
        if ($tenant !== null) {
            $this->tenant = $tenant;
        } elseif ($tokenStorage !== null) {
            $token = $tokenStorage->getToken();

            if ($token !== null) {
                $tenant = $token->getUser();

                if ($tenant instanceof TenantInterface) {
                    $this->tenant = $tenant;
                }
            }
        } else {
            throw new \RuntimeException('Can\'t get tenant');
        }
    }
148649
public function addCollection(Collection $collection)
    {
        $metadata = $collection->getDocumentMetadata();
        $this->collectionMapping[$metadata->getName()] = $collection;
    }
1080119
protected function addActiveConnection(ConnectionInterface $connection)
    {
        if (!$this->activeConnections) {
            $this->activeConnections = new \SplObjectStorage;
        }
        $this->activeConnections->attach($connection);
    }
1221417
public function merge(CollectionInterface ...$collections): CollectionInterface
    {
        $temp = [$this->data];

        foreach ($collections as $index => $collection) {
            if (!$collection instanceof static) {
                throw new CollectionMismatchException(
                    \sprintf('Collection with index %d must be of type %s', $index, static::class)
                );
            }

            $temp[] = $collection->toArray();
        }

        return new static(\array_merge(...$temp));
    }
1234832
protected function loadProfilerCollector(ContainerBuilder $container, XmlFileLoader $loader)
    {
        if ($container->getParameter('kernel.debug')) {
            $loader->load('collector.xml');

            $services = $container->findTaggedServiceIds('eko.google_translate.method');
            $identifiers = array_keys($services);

            foreach ($identifiers as $identifier) {
                $serviceDefinition = $container->getDefinition($identifier);
                $serviceDefinition->addArgument(new Reference('debug.stopwatch'));

                $container->setDefinition($identifier, $serviceDefinition);
            }
        }
    }