Barryvdh\Debugbar\LaravelDebugbar::collect PHP Method

collect() public method

Collects the data from the collectors
public collect ( ) : array
return array
    public function collect()
    {
        /** @var Request $request */
        $request = $this->app['request'];
        $this->data = ['__meta' => ['id' => $this->getCurrentRequestId(), 'datetime' => date('Y-m-d H:i:s'), 'utime' => microtime(true), 'method' => $request->getMethod(), 'uri' => $request->getRequestUri(), 'ip' => $request->getClientIp()]];
        foreach ($this->collectors as $name => $collector) {
            $this->data[$name] = $collector->collect();
        }
        // Remove all invalid (non UTF-8) characters
        array_walk_recursive($this->data, function (&$item) {
            if (is_string($item) && !mb_check_encoding($item, 'UTF-8')) {
                $item = mb_convert_encoding($item, 'UTF-8', 'UTF-8');
            }
        });
        if ($this->storage !== null) {
            $this->storage->save($this->getCurrentRequestId(), $this->data);
        }
        return $this->data;
    }

Usage Example

 /**
  * Collects the data from the collectors
  *
  * @return array 
  * @static 
  */
 public static function collect()
 {
     return \Barryvdh\Debugbar\LaravelDebugbar::collect();
 }