'string',
'bool' => 'boolean',
'int' => 'integer',
);
public function docParameter($params, $serviceTypes)
{
$this->serviceTypes = $serviceTypes;
$output = '';
if (count($params)>0) {
$output.= '
';
foreach ($params as $param) {
$output.= $this->formatParam($param);
}
$output.= '
';
}
return $output;
}
private function parseType($type)
{
$output = '';
$type = str_replace('[]', '', $type);
if (array_key_exists($type, $this->serviceTypes)) {
$types = $this->serviceTypes[$type];
$output.= '';
foreach ($types as $param) {
$output.= $this->formatParam($param);
}
$output.= '
';
} elseif (in_array($type, array(
'string', 'str',
'boolean', 'bool',
'integer', 'int',
'float', 'double',
'array', 'object', 'mixed'))) {
$output.= '';
} elseif ($type == 'void'){
$output.= 'Void';
} else {
$output.= ' => Type '.$type.' Inconnu';
}
return $output;
}
private function formatParam($param)
{
$output = '';
$output.= '';
$output.= '' . $this->transcodeType($param['type']) . '';
$output.= ' ';
$output.= $param['name'];
if (isset($param['description']) && !empty($param['description'])) {
$output.= ' : '.$param['description'];
}
if (!in_array($param['type'], $this->types)) {
$output.= $this->parseType($param['type']);
}
$output.= '';
return $output;
}
private function transcodeType($type)
{
if(array_key_exists($type, $this->_transcodeType)){
return $this->_transcodeType[$type];
} else {
return $type;
}
}
}