💡 PHPDoc for REST API

This commit is contained in:
Pierre Goiffon
2019-03-04 16:00:22 +01:00
parent 3de7aa1ada
commit 44f5d71e1b
4 changed files with 18 additions and 7 deletions

View File

@@ -869,7 +869,8 @@ class RestUtils
* *
* @param StdClass $oData Structured input data. Must contain the entry defined by sParamName. * @param StdClass $oData Structured input data. Must contain the entry defined by sParamName.
* @param string $sParamName Name of the parameter to fetch from the input data * @param string $sParamName Name of the parameter to fetch from the input data
* @return void *
* @return string
* @throws Exception If the parameter is missing * @throws Exception If the parameter is missing
* @api * @api
*/ */
@@ -914,7 +915,8 @@ class RestUtils
* *
* @param StdClass $oData Structured input data. Must contain the entry defined by sParamName. * @param StdClass $oData Structured input data. Must contain the entry defined by sParamName.
* @param string $sParamName Name of the parameter to fetch from the input data * @param string $sParamName Name of the parameter to fetch from the input data
* @return void *
* @return string
* @throws Exception If the parameter is missing or the class is unknown * @throws Exception If the parameter is missing or the class is unknown
* @api * @api
*/ */

View File

@@ -299,9 +299,16 @@ class CoreServices implements iRestServiceProvider
/** /**
* Enumerate services delivered by this class * Enumerate services delivered by this class
*
* @param string $sVersion The version (e.g. 1.0) supported by the services * @param string $sVersion The version (e.g. 1.0) supported by the services
* @param string $sVerb
* @param $aParams
*
* @return RestResult The standardized result structure (at least a message) * @return RestResult The standardized result structure (at least a message)
* @throws Exception in case of internal failure. * @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \SimpleGraphException
* @throws \Exception
*/ */
public function ExecOperation($sVersion, $sVerb, $aParams) public function ExecOperation($sVersion, $sVerb, $aParams)
{ {

View File

@@ -81,7 +81,7 @@ class RestResultListOperations extends RestResult
$this->operations[] = array( $this->operations[] = array(
'verb' => $sVerb, 'verb' => $sVerb,
'description' => $sDescription, 'description' => $sDescription,
'extension' => $sServiceProviderClass 'extension' => $sServiceProviderClass,
); );
} }
} }
@@ -94,7 +94,7 @@ if (!function_exists('json_last_error_msg')) {
JSON_ERROR_STATE_MISMATCH => 'State mismatch (invalid or malformed JSON)', JSON_ERROR_STATE_MISMATCH => 'State mismatch (invalid or malformed JSON)',
JSON_ERROR_CTRL_CHAR => 'Control character error, possibly incorrectly encoded', JSON_ERROR_CTRL_CHAR => 'Control character error, possibly incorrectly encoded',
JSON_ERROR_SYNTAX => 'Syntax error', JSON_ERROR_SYNTAX => 'Syntax error',
JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded' JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded',
); );
$error = json_last_error(); $error = json_last_error();
@@ -172,6 +172,7 @@ try
} }
/** var iRestServiceProvider[] $aProviders */
$aProviders = array(); $aProviders = array();
foreach(get_declared_classes() as $sPHPClass) foreach(get_declared_classes() as $sPHPClass)
{ {
@@ -183,6 +184,7 @@ try
} }
$aOpToRestService = array(); // verb => $oRestServiceProvider $aOpToRestService = array(); // verb => $oRestServiceProvider
/** @var iRestServiceProvider $oRestSP */
foreach ($aProviders as $oRestSP) foreach ($aProviders as $oRestSP)
{ {
$aOperations = $oRestSP->ListOperations($sVersion); $aOperations = $oRestSP->ListOperations($sVersion);

View File

@@ -36,8 +36,8 @@ class BasicServices extends WebServicesBase
/** /**
* Get the server version (TODO: get it dynamically, where ?) * Get the server version (TODO: get it dynamically, where ?)
* *
* @return WebServiceResult * @return string WebServiceResult
*/ */
static public function GetVersion() static public function GetVersion()
{ {