<?php
$xml = simplexml_load_file($xml_dir.$_GET['class']);
$class_name = $xml->class['name'];
echo "<h1>$class_name</h1>";
$methods = $xml->class->methods;
foreach($methods as $method)
{
foreach($method as $function)
{
$method_name = $function['name'];
$method_visibility = $function['visibility'];
$method_example = $function['example'];
$method_description = $function->description;
$method_return_type = $function->return['type'];
$method_return = $function->return;
if($method_name == $_GET['method'])
{
echo "<h3>$method_visibility $method_name</h3>";
echo "<div>$method_description</div>";
echo "<h5>Parâmetros do método</h5>";
$params = $function->params;
foreach($params as $param)
{
foreach($param as $parameter)
{
$param_name = $parameter['name'];
$param_type = $parameter['type'];
$param_name = $parameter['name'];
$param_optional = $parameter['optional'];
$param_default = $parameter['default'];
$param_description = $parameter;
if($param_optional == "false")
{
$optional = 'requerido';
}
else
{
$optional = 'opcional';
}
if(strlen($param_default) > 0)
{
$default = "valor padrão: $param_default";
}
else
{
$default = '';
}
echo "<dl>";
echo "<dt>($param_type) $param_name - <i>$optional</i> <i>$default</i></dt>";
echo "<dd>$param_description</dd>";
echo "</dl>";
}
}
echo "<div>";
echo "<strong>Retorno: </strong>($method_return_type) $method_return";
echo "</div>";
if(strlen($method_example) > 0)
{
echo "<div>";
echo "<p><a href='$example_dir$method_example' target='_blank'>Teste</a> este exemplo!</p>";
highlight_file($example_dir.$method_example);
echo "</div>";
}
}
}
}
?>
|