2016-04-18 08:30:40 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace manager\module;
|
|
|
|
use \manager\ManagerError;
|
2016-04-30 09:33:01 +00:00
|
|
|
use \manager\ResourceDispatcher;
|
2016-04-18 08:30:40 +00:00
|
|
|
|
|
|
|
class module{
|
|
|
|
|
2016-04-30 09:33:01 +00:00
|
|
|
/* PERMET DE TESTER L'API
|
|
|
|
*
|
|
|
|
*/
|
2016-04-18 08:30:40 +00:00
|
|
|
public static function method(){
|
|
|
|
|
|
|
|
return array(
|
2016-04-18 09:30:38 +00:00
|
|
|
'ModuleError' => ManagerError::Success,
|
|
|
|
'ReceivedArguments' => func_get_args()
|
2016-04-18 08:30:40 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-04-30 09:33:01 +00:00
|
|
|
/* PERMET DE TESTER UNE L'ORDRE DES PARAMÈTRES
|
|
|
|
*
|
|
|
|
*/
|
2016-04-18 09:30:38 +00:00
|
|
|
public static function phpunitParams($params){
|
|
|
|
extract($params);
|
|
|
|
|
|
|
|
return array(
|
|
|
|
'ModuleError' => ManagerError::Success,
|
|
|
|
'p1' => $p1,
|
|
|
|
'p2' => $p2
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2016-04-30 09:33:01 +00:00
|
|
|
/* RENVOIE UNE DESCRIPTION EN MARKDOWN DES MODULES DE L'API
|
|
|
|
*
|
|
|
|
* @return markdown<String> Description des modules
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public static function markdown(){
|
|
|
|
/* [1] Récupération de la configuration
|
|
|
|
=========================================================*/
|
|
|
|
// On récupère le fichier et on le parse
|
|
|
|
$modules = json_decode( ResourceDispatcher::getResource('f/json/modules/conf'), true );
|
|
|
|
|
|
|
|
// Gestion de l'erreur de parsage
|
|
|
|
if( $modules == null )
|
|
|
|
return array( 'ModuleError' => ManagerError::ParsingFailed );
|
|
|
|
|
|
|
|
/* [2] Mise en forme de la liste des modules
|
|
|
|
=========================================================*/
|
|
|
|
$markdown = "## Module List<br>";
|
|
|
|
|
|
|
|
foreach($modules as $moduleName=>$moduleData)
|
|
|
|
$markdown .= "- $moduleName<br>";
|
|
|
|
|
|
|
|
/* [3] Mise en forme des méthodes des modules
|
|
|
|
=========================================================*/
|
|
|
|
$markdown .= '----<br>## Method List & Description<br>';
|
|
|
|
|
|
|
|
$count = 1;
|
|
|
|
foreach($modules as $moduleName=>$moduleData){
|
|
|
|
$markdown .= "### $count - '$moduleName' methods<br>";
|
|
|
|
|
|
|
|
foreach($moduleData as $methodName=>$methodData)
|
2016-05-02 10:22:54 +00:00
|
|
|
$markdown .= "`$methodName` - ".$methodData['description']."<br>";
|
2016-04-30 09:33:01 +00:00
|
|
|
|
|
|
|
$markdown .= '----<br>';
|
|
|
|
|
|
|
|
$count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* [n] Gestion du retour
|
|
|
|
=========================================================*/
|
|
|
|
return array(
|
|
|
|
'ModuleError' => ManagerError::Success,
|
|
|
|
'markdown' => $markdown
|
|
|
|
);
|
|
|
|
}
|
2016-04-18 09:30:38 +00:00
|
|
|
|
2016-04-18 08:30:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-04-30 09:33:01 +00:00
|
|
|
|
2016-04-18 08:30:40 +00:00
|
|
|
?>
|