public function log($appId, $routeId, $ip, RequestInterface $request) { $now = new \DateTime(); $this->connection->insert('fusio_log', array('appId' => $appId, 'routeId' => $routeId, 'ip' => $ip, 'userAgent' => $request->getHeader('User-Agent'), 'method' => $request->getMethod(), 'path' => $request->getRequestTarget(), 'header' => $this->getHeadersAsString($request), 'body' => $this->getBodyAsString($request), 'date' => $now->format('Y-m-d H:i:s'))); return $this->connection->lastInsertId(); }
/** * @param \PSX\Http\RequestInterface $request * @return string */ public static function buildStatusLine(RequestInterface $request) { $method = $request->getMethod(); $target = $request->getRequestTarget(); $protocol = $request->getProtocolVersion(); if (empty($target)) { throw new Exception('Target not set'); } $method = !empty($method) ? $method : 'GET'; $protocol = !empty($protocol) ? $protocol : 'HTTP/1.1'; return $method . ' ' . $target . ' ' . $protocol; }