public function get($logId) { $log = $this->logTable->get($logId); if (!empty($log)) { // append errors $log['errors'] = $this->logTable->getErrors($log['id']); return $log; } else { throw new StatusCode\NotFoundException('Could not find log'); } }
/** * @param string $ip * @param string $timespan * @param \Fusio\Engine\Model\App $app * @return integer */ protected function getRequestCount($ip, $timespan, Model\App $app) { if (empty($timespan)) { return 0; } $now = new \DateTime(); $past = new \DateTime(); $past->sub(new \DateInterval($timespan)); $condition = new Condition(); if ($app->isAnonymous()) { $condition->equals('ip', $ip); } else { $condition->equals('appId', $app->getId()); } $condition->between('date', $past->format('Y-m-d H:i:s'), $now->format('Y-m-d H:i:s')); return $this->logTable->getCount($condition); }