Zend_Reflectionサンプル
ファイルでreflectionを実行
The %s file\n".
" has %d lines\n",
$r->getFileName(),
$r->getEndLine()
);
$classes = $r->getClasses();
echo " It has " . count($classes) . ":\n";
foreach ($classes as $class) {
echo " " . $class->getName() . "\n";
}
$functions = $r->getFunctions();
echo " It has " . count($functions) . ":\n";
foreach ($functions as $function) {
echo " " . $function->getName() . "\n";
}
]]>
クラスでreflectionを実行
getDocblock()->getShortDescription(),
$r->getDocblock()->getLongDescription(),
);
//宣言するファイルreflectionを取得
$file = $r->getDeclaringFile();
]]>
メソッドでreflectionを実行
getName());
foreach ($r->getParameters() as $key => $param) {
printf(
"Param at position '%d' is of type '%s'\n",
$key,
$param->getType()
);
}
]]>
docblockでreflectionを実行
getDocblock();
printf(
"短い記述: %s\n".
"長い記述:\n%s\n",
$r->getDocblock()->getShortDescription(),
$r->getDocblock()->getLongDescription(),
);
foreach ($docblock->getTags() as $tag) {
printf(
"Annotation tag '%s' has the description '%s'\n",
$tag->getName(),
$tag->getDescription()
);
}
]]>