language = $request->header->l11n->language; $this->country = $request->header->l11n->country; $this->uri = \substr($request->uri->uri, 0, 255); $this->host = $request->uri->host; $this->path = \substr($request->uri->path, 0, 255); $this->address = $request->header->getRequestIp(); $this->datetime = new \DateTime('@' . $request->header->getRequestTime()); $this->referer = \substr($request->header->getReferer(), 0, 255); $this->userAgent = $request->header->getBrowserName(); } /** * Turn object to array * * @return array * * @since 1.0.0 */ public function toArray() : array { return [ 'address' => $this->address, 'date' => $this->datetime->format('Y-m-d'), 'hour' => $this->datetime->format('H'), 'host' => $this->host, 'path' => $this->path, 'uri' => $this->uri, 'agent' => $this->userAgent, 'language' => $this->language, 'country' => $this->country, 'referer' => $this->referer, 'datetime' => $this->datetime->getTimestamp(), 'end' => $this->end?->getTimestamp(), 'meta' => $this->meta, ]; } }