* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class Markdown extends MarkupAbstract { /** * @param \PSX\Schema\GeneratorInterface|null $generator */ public function __construct(GeneratorInterface $generator = null) { // by default we use the html generator since the markdown renderer uses // a table syntax which is not supported everywhere $this->generator = $generator === null ? new Generator\Html(4) : $generator; } /** * @param \PSX\Api\Resource $resource * @return string */ protected function startResource(Resource $resource) { $md = '' . "\n"; $md.= '# ' . $resource->getPath() . "\n"; $md.= '' . "\n"; $description = $resource->getDescription(); if (!empty($description)) { $md.= $description . "\n"; $md.= '' . "\n"; } return $md; } /** * @return string */ protected function endResource() { return "\n"; } /** * @param \PSX\Api\Resource\MethodAbstract $method * @return string */ protected function startMethod(Resource\MethodAbstract $method) { $md = '' . "\n"; $md.= '## ' . $method->getName() . "\n"; $md.= '' . "\n"; $description = $method->getDescription(); if (!empty($description)) { $md.= $description . "\n"; $md.= '' . "\n"; } return $md; } /** * @return string */ protected function endMethod() { } /** * @inheritDoc */ protected function renderSchema(string $title, string $schema) { $html = '### ' . $title . "\n"; $html = '* ' . $title . ': [' . $schema . '](#' . $schema . ')' . "\n"; return $html; } } __halt_compiler();----SIGNATURE:----jjfocGRoWjPtUyRBOdMHy7ZCOwl44cf9xOtBbkKGrWXX1kVGQJ6hsxZCig+kHLaHNhCWaTfGe8oaib9zxPAQkR4cgvEtsFP8WSv4M8z2EH1qL5jwGIKtfbdWUlDAeGiC5d1aUq+op4A9ZSibDRoi+d+N+D6VXUCZKT/UC12mhW5mDm8fGZA6eNWFScpSRr2qAQpeIoD+5hPBw/71AMtrj1ee/mwvN4jI0JIaiza042t4mo6j+mbjEpaQH1VE84kSVemw98bIuTj9+07bc/UbScnh7rkwzOFPoDwlC8CQ9R3oHBu6kaF3YDxmvoGQcIuXORmd7RPkNbGZT87cSu0Ue4ZBqTu316sb1fmRL4Ezc6EoJFuhKKhfgZQ7rXldGmB78DmPhNfJWl7qahyLH8ZQCGLFTrrMowDK9cCLEINPsd3RTHBOt3JQFmjYy3ssWkuf8YCQuSaCwci1fUzeJjyuzI8Qv9J1oQCQzlBpY1xEo92ypbpmZmm80k8Ao+PfuUARvjbJ5BCvZHs1yqAq7G0hm8xJV1YeE6Kz0PamXJF9Wskjy0JPngVOBuNOhkNwEwHxTlHTKauoIpGkljQsTzaFZ5FHOLtcEz03pCfYX77nEEHKhoDTQPyCEtuWEpf+4mjSTJJcCDhdjfbAC17yApoeWp6MJHhwHIOy6Ls4WLg12p8=----ATTACHMENT:----ODA2Nzc0Njk5NjkxMDA5MCA4MjMyNTEzNDAwNTI4NDY0IDIyNDA0OTkwMjcwNzAxMA==