minmod: api.core.Documentation

This commit is contained in:
xdrm-brackets 2017-12-13 12:44:39 +01:00
parent 7f4662eaa6
commit 73925299a2
1 changed files with 4 additions and 8 deletions

View File

@ -37,7 +37,7 @@
foreach($cfg as $method=>$spec){ foreach($cfg as $method=>$spec){
/* (1) Build uri with args */ /* (1) Build uri with args */
$cfg[$method]['uri_scheme'] = self::uri_with_parameters($rq->get('id')['path'], $spec); $cfg[$method]['uri_scheme'] = self::uri_scheme($rq->get('id')['path'], $spec);
/* (2) Build human-readable permission list */ /* (2) Build human-readable permission list */
$cfg[$method]['perm'] = "accessible with:".self::permissions($spec); $cfg[$method]['perm'] = "accessible with:".self::permissions($spec);
@ -59,7 +59,7 @@
* @spec<array> Specification * @spec<array> Specification
* *
---------------------------------------------------------*/ ---------------------------------------------------------*/
private static function uri_with_parameters($uri=null, $spec=null){ private static function uri_scheme($uri=null, $spec=null){
/* (1) If no param return nothing */ /* (1) If no param return nothing */
if( !isset($spec['par']) || !is_array($spec['par']) || count($spec['par']) <= 0 ) if( !isset($spec['par']) || !is_array($spec['par']) || count($spec['par']) <= 0 )
@ -99,11 +99,7 @@
/* (2.2) Define the 'optional' property */ /* (2.2) Define the 'optional' property */
$optional = ( isset($pspec['opt']) && $pspec['opt'] === true ) ? '?' : ''; $optional = ( isset($pspec['opt']) && $pspec['opt'] === true ) ? '?' : '';
/* (2.3) Define the 'default' property */ /* (2.3) If 'rename' set the rename content */
$optional .= ( $optional == '?' && isset($pspec['def']) ) ? json_encode($pspec['def']) : 'null';
/* (2.4) If 'rename' set the rename content */
if( isset($pspec['ren']) && is_string($pspec['ren']) ){ if( isset($pspec['ren']) && is_string($pspec['ren']) ){
$uri .= '/@'.$pspec['ren']."$optional"; $uri .= '/@'.$pspec['ren']."$optional";
@ -111,7 +107,7 @@
} }
/* (2.5) If no rename set the default name */ /* (2.4) If no rename set the default name */
$uri .= "/@url$i$optional"; $uri .= "/@url$i$optional";
} }