protected function setWriterConfig(WriterResult $writer) { switch ($writer->getType()) { case WriterInterface::ATOM: $updated = $this->getSql()->getField('SELECT `date` FROM ' . $this->registry['table.forum'] . ' ORDER BY `date` DESC LIMIT 1'); $title = 'Forum'; $id = 'urn:uuid:' . $this->base->getUUID('forum'); $updated = new DateTime($updated, $this->registry['core.default_timezone']); $writer = $writer->getWriter(); $writer->setConfig($title, $id, $updated); $writer->setGenerator('amun ' . Base::getVersion()); if (!empty($this->config['amun_hub'])) { $writer->addLink($this->config['amun_hub'], 'hub'); } break; } }
/** * @httpMethod GET * @path /{service} * @nickname getApiDetails * @responseClass Declaration */ public function getApiDetails() { try { $basePath = $this->config['psx_url'] . '/' . $this->config['psx_dispatch'] . 'api'; $serviceName = strtolower($this->getUriFragments('service')); $cache = new Cache('swagger-api-detail-' . $serviceName); if (($declaration = $cache->load()) === false) { $declaration = new Declaration(Base::getVersion(), $basePath, null); $this->buildApiDetails($declaration, $serviceName); $cache->write(serialize($declaration)); } else { $declaration = unserialize($declaration); } $this->setResponse($declaration); } catch (\Exception $e) { $msg = new Message($e->getMessage(), false); $this->setResponse($msg); } }
private function isMaxVersion($value) { $a = Base::getVersion(); $b = $value; return version_compare($a, $b, '<='); }
protected function setWriterConfig(WriterResult $writer) { switch ($writer->getType()) { case WriterInterface::ATOM: $account = $this->getHandler('AmunService\\User\\Account')->getOneById($this->userId, array('id', 'globalId', 'name', 'profileUrl', 'thumbnailUrl', 'updated'), Sql::FETCH_OBJECT); if ($account instanceof Account\Record) { $writer = $writer->getWriter(); $writer->setConfig($account->name . ' activities', 'urn:uuid:' . $account->globalId, $account->getUpdated()); $writer->setGenerator('amun ' . Base::getVersion()); $writer->addAuthor($account->name, $account->profileUrl); $writer->addLink($account->profileUrl, 'alternate', 'text/html'); $writer->addLink($account->thumbnailUrl, 'avatar'); $writer->setLogo($account->thumbnailUrl); if (!empty($this->config['amun_hub'])) { $writer->addLink($this->config['amun_hub'], 'hub'); } } else { throw new Exception('Invalid user account'); } break; } }