1. Go to this page and download the library: Download luler/anodoc library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
luler / anodoc example snippets
/**
* A test summary
*
* And here's a longer description that explains in detail
* what this section is all about.
*
* @param foo bar
* @param boo far
* @return baz
*/
$parser = new Anodoc\Parser;
// This returns a new Anodoc\DocComment object.
$doc = $parser->parse(
"/**\n" .
" * A test summary\n" .
" *\n" .
" * And here's a longer description that explains in detail\n" .
" * what this section is all about.\n" .
" *\n" .
" * @param foo bar\n" .
" * @param boo far\n" .
" * @return baz\n" .
" */"
);
echo $doc->getShortDescription();
// "A test summary"
echo $doc->getLongDescription();
// And here's a longer description that explains in detail
// what this section is all about.
echo $doc->getTagValue('return');
// baz
$doc->getTag('return');
// A Tag object with value 'baz'
echo $doc->getTagValue('param'); // this will return the last defined value
// boo far
var_dump($doc->getTags('param'));
// a dump of a TagGroup that has 2 values
// Factory instantiates a new Anodoc object
// With a Parser
$anodoc = Anodoc::getNew();
$classDoc = $anodoc->getDoc('FooClass');
// Get the main class doc comment description
echo $classDoc->getMainDoc();
// Get the doc comment for method FooClass::fooMethod()
$classDoc->getMethodDoc('fooMethod')
// Get the doc comment for the attribute $bar
$classDoc->getAttributeDoc('bar');
namespace Anodoc\Tags;
class ParamTag extends Tag {
private $tag_name, $value;
function __construct($tag_name, $value) {
preg_match('/(\w+)\s+\$(\w+)\s+(.+)/ms', $value, $matches);
$this->value = array(
'type' => $matches[1],
'name' => $matches[2],
'description' => $matches[3]
);
$this->tag_name = $tag_name;
}
function getValue() {
return $this->value;
}
function getTagName() {
return $this->tag_name;
}
function __toString() {
return (string) $this->value;
}
}
$anodoc = Anodoc::getNew();
$anodoc->registerTag('param', 'Anodoc\Tags\ParamTag');
$classDoc = $anodoc->getDoc('FooClass');
$param = $classDoc->getMethodDoc('fooMethod')->getTag('param');
// returns an 'Anodoc\Tags\ParamTag' object
$param->getValue();
// if the param tag looks like this:
// @param string $firstName the first name of the person
// The value would be:
// array(
// 'type' => 'string', 'name' => 'firstName',
// 'description' => 'the first name of the person'
// )
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.