<?php /** * @var \Briedis\ApiBuilder\MethodGroup $group * @var \Briedis\ApiBuilder\Presenter $presenter */ use Briedis\ApiBuilder\Presenter; ?> <h1 id="<?php echo htmlspecialchars($group->getDocElementName()); ?> "><?php echo $group->getTitle(); ?> </h1> <?php foreach ($group->getItems() as $v) { echo Presenter::view('method', ['apiMethod' => $v, 'presenter' => $presenter]); }
<?php /** * @var string $methodHtml Method contents */ use Briedis\ApiBuilder\Presenter; ?> <script src="<?php echo Presenter::resourceUrl('script.js'); ?> " type="text/javascript"></script> <link rel="stylesheet" href="<?php echo Presenter::resourceUrl('style.css'); ?> " property='stylesheet'> <?php echo $methodHtml;
echo $v->name; ?> <?php if (!$v->isOptional) { ?> <span class="required" title="Required">*</span> <?php } ?> </div> <div class="format"><?php echo $v->getDisplayTypeName(); ?> </div> <div class="description"><?php echo $v->description; ?> </div> </div> </div> <?php if ($v instanceof StructureItem) { ?> <div class="sub"> <?php echo Presenter::view('structure', ['structure' => $v->structure]); ?> </div> <?php } }
</li> <li> <a href="javascript:" data-target="parameters">Parameters</a> </li> <li> <a href="javascript:" data-target="response">Response</a> </li> </ul> <div class="tab description"><?php echo $apiMethod->description; ?> </div> <div class="tab parameters hidden"> <div class="param-block"> <?php echo Presenter::view('structure', ['structure' => $apiMethod->getRequest()]); ?> </div> </div> <div class="tab response hidden"> <div class="param-block"> <?php echo Presenter::view('structure', ['structure' => $apiMethod->getResponse()]); ?> </div> </div> </div> </div>
<?php include __DIR__ . '/../vendor/autoload.php'; use Briedis\ApiBuilder\Presenter; include __DIR__ . '/ExampleGetUserRequest.php'; include __DIR__ . '/Structures/response/LocationStructure.php'; include __DIR__ . '/Structures/response/UserStructure.php'; include __DIR__ . '/Structures/request/GetUsersStructure.php'; $presenter = new Presenter(); // Set a translation callback, if needed $presenter->setTranslateCallback(function ($key) { return $key; // Call your trans() function }); $presenter->add(new ExampleGetUserRequest()); ?> <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css"> </head> <body> <div class="container"> <?php echo $presenter->render(); ?> </div> </body> </html>