public function onGet() { parent::onGet(); $links = []; $apiPath = $this->reverseRouter->getDispatchUrl(); if ($apiPath !== null) { $links[] = new Object(['rel' => 'api', 'href' => $apiPath]); } $routingPath = $this->reverseRouter->getUrl('PSX\\Controller\\Tool\\RoutingController'); if ($routingPath !== null) { $links[] = new Object(['rel' => 'routing', 'href' => $routingPath]); } $commandPath = $this->reverseRouter->getUrl('PSX\\Controller\\Tool\\CommandController'); if ($commandPath !== null) { $links[] = new Object(['rel' => 'command', 'href' => $commandPath]); } $documentationPath = $this->reverseRouter->getUrl('PSX\\Controller\\Tool\\DocumentationController::doIndex'); if ($documentationPath !== null) { $links[] = new Object(['rel' => 'documentation', 'href' => $documentationPath]); } $ramlGeneratorPath = $this->reverseRouter->getUrl('PSX\\Controller\\Tool\\RamlGeneratorController', ['{version}', '{path}']); if ($ramlGeneratorPath !== null) { $links[] = new Object(['rel' => 'raml', 'href' => $ramlGeneratorPath]); } $wsdlGeneratorPath = $this->reverseRouter->getUrl('PSX\\Controller\\Tool\\WsdlGeneratorController', ['{version}', '{path}']); if ($wsdlGeneratorPath !== null) { $links[] = new Object(['rel' => 'wsdl', 'href' => $wsdlGeneratorPath]); } $swaggerGeneratorPath = $this->reverseRouter->getUrl('PSX\\Controller\\Tool\\SwaggerGeneratorController::doDetail', ['{version}', '{path}']); if ($swaggerGeneratorPath !== null) { $links[] = new Object(['rel' => 'swagger', 'href' => $swaggerGeneratorPath]); } $this->setBody(['links' => $links]); }
public function onGet() { parent::onGet(); $commandClass = $this->getParameter('command'); if (!empty($commandClass)) { $command = $this->commandFactory->getCommand($commandClass, new Context()); $parameters = $command->getParameters(); $data = array(); foreach ($parameters as $parameter) { $data[] = new Record('parameter', ['name' => $parameter->getName(), 'description' => $parameter->getDescription(), 'type' => $parameter->getType()]); } $this->setBody(array('command' => $commandClass, 'description' => $parameters->getDescription(), 'parameters' => $data)); } else { $this->setBody(array('commands' => (object) $this->executor->getAliases())); } }
public function onGet() { parent::onGet(); $this->setBody(array('routings' => $this->getRoutings())); }