ptut-vhost/build/api/core/Documentation.php

50 lines
901 B
PHP
Raw Normal View History

2018-02-17 17:18:58 +00:00
<?php
namespace api\core;
use \error\core\Error;
use \error\core\Err;
use \api\core\Request;
use \api\core\Config;
class Documentation{
/* (1) Attributes
---------------------------------------------------------*/
/* (1) Static */
/* (2) Instance */
/* (2) Builds the documentation
*
---------------------------------------------------------*/
public function generate(Request $rq=null){
/* (1) Get data from config
---------------------------------------------------------*/
/* (1) If no index for this path -> exit */
if( !isset(Config::get()->index[$rq->get('id')['path']]) )
return new Response(new Error(Err::WrongPathModule));
/* (2) Local store: configuration for this path */
$cfg = Config::get()->index[$rq->get('id')['path']];
$response = new Response();
$response->append('methods', $cfg);
return $response;
}
}