Adds a data collector

@param DataCollectorInterface $collector

@throws DebugBarException
@return $this
553766
public function addCollector(DataCollectorInterface $collector)
    {
        if ($collector->getName() === '__meta') {
            throw new DebugBarException("'__meta' is a reserved name and cannot be used as a collector name");
        }
        if (isset($this->collectors[$collector->getName()])) {
            throw new DebugBarException("'{$collector->getName()}' is already a registered collector");
        }
        $this->collectors[$collector->getName()] = $collector;
        return $this;
    }
1203844
public function merge(AbstractCollection $collection)
    {
        if (is_subclass_of($collection, get_class($this)) === true || get_class($collection) === get_class($this)) {
            $newData = array_merge($this->dataPlaceHolder, $collection->getDataPlaceHolder());
            $this->dataPlaceHolder = $newData;
        } else {
            $msg = "Only collections with compliant types can be merged ";
            $msg.= "('" . get_class($this) . "' vs '" . get_class($collection) . "').";
            throw new InvalidArgumentException($msg);
        }
    }
16207
public function loadCollection(PersistentCollectionInterface $collection) : void
    {
        $mapping = $collection->getMapping();
        switch ($mapping['association']) {
            case ClassMetadata::EMBED_MANY:
                $this->loadEmbedManyCollection($collection);
                break;

            case ClassMetadata::REFERENCE_MANY:
                if (isset($mapping['repositoryMethod']) && $mapping['repositoryMethod']) {
                    $this->loadReferenceManyWithRepositoryMethod($collection);
                } else {
                    if ($mapping['isOwningSide']) {
                        $this->loadReferenceManyCollectionOwningSide($collection);
                    } else {
                        $this->loadReferenceManyCollectionInverseSide($collection);
                    }
                }
                break;
        }
    }
1216228
public function add($items)
    {
        if (is_array($items)) {
            $this->collection[] = new RecordField($items);
        } elseif (is_object($items) && $items instanceof RecordField) {
            $this->collection[] = $items;
        }

        return $this;
    }
226330
protected function addCollection()
    {
        if (!$this->isError()) {
            $id = $this->collection->add($this->getSubmitted());
            if (empty($id)) {
                $this->errorAndExit($this->text('Unexpected result'));
            }
            $this->line($id);
        }
    }
669578
public function addContainer(ContainerInterface $container)
    {
        $container->setDelegator($this);
        $this->containers[] = $container;
        return $this;
    }
245516
protected function addPreview(Collection $collection)
    {
        return $collection->setPreview(
            $this->getPreview($collection->getId(), $collection->getLocale())
        );
    }
312596
public function addMessage($message, $label = 'info')
    {
        if ($this->hasCollector('messages')) {
            /** @var \DebugBar\DataCollector\MessagesCollector $collector */
            $collector = $this->getCollector('messages');
            $collector->addMessage($message, $label);
        }
    }
400790
protected function addCollectionItem()
    {
        if (!$this->isError()) {
            $id = $this->collection_item->add($this->getSubmitted());
            if (empty($id)) {
                $this->errorAndExit($this->text('Unexpected result'));
            }
            $this->line($id);
        }
    }
1052666
function giveCollection(MongoDB\Collection $collection)
    {
        if ($this->collection)
            throw new exImmutable;


        $this->collection = $collection;
        return $this;
    }
1149625
public function addThrowable($e)
    {
        if ($this->hasCollector('exceptions')) {
            /** @var \DebugBar\DataCollector\ExceptionsCollector $collector */
            $collector = $this->getCollector('exceptions');
            $collector->addThrowable($e);
        }
    }
1019909
public function add($row = []): CollectionInterface
    {
        //if it's an array
        if (is_array($row)) {
            //make it a model
            $row = $this->getModel($row);
        }

        //add it now
        $this->data[] = $row;

        return $this;
    }
401707
public function add($entity)
    {
        $class = $this->entityClass;

        if (!$entity instanceof $class) {
            throw new CollectionException('class must an instance of ' . $class);
        }

        $this->entities[] = $entity;

        return $this;
    }
319106
protected function loadDefaultWith(EloquentCollection $collection): self
    {
        if ($collection->isEmpty()) {
            return $this;
        }

        $model = $collection->first();
        $reflection = new ReflectionClass($model);
        $withProperty = $reflection->getProperty('with');
        $withProperty->setAccessible(true);

        $with = array_filter((array) $withProperty->getValue($model), function ($relation) use ($model) {
            return ! $model->relationLoaded($relation);
        });

        if (! empty($with)) {
            $collection->load($with);
        }

        return $this;
    }
770485
public function addDeserializer(JsonDeserializerInterface $deserializer): EntryPoint
    {
        foreach ($deserializer->getSupportedTypes() as $type) {
            $this->deserializers[$type] = $deserializer;
        }

        return $this;
    }
1371311
protected function setCollectorHandler(ResultInterface $result)
    {
        $status = $result->getStatus();
        if (is_null($result->getHandler()) && $this->getHandler($status)) {
            // debug message
            $this->debug(Message::get(
                Message::DEBUG_SET_C_HANDLER,
                get_class($this),
                $status
            ));
            $result->setHandler($this->getHandler($status));
        }
        return $this;
    }
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);
    }