67 lines
1.2 KiB
PHP
67 lines
1.2 KiB
PHP
|
<?php
|
||
|
/**
|
||
|
* Testclass in order to test phpdoc-stuff with the php reflection api
|
||
|
* Shall help in order to find out how this stuff works.
|
||
|
* @author jpt
|
||
|
*/
|
||
|
class TestClassForTestsWithReflection {
|
||
|
|
||
|
/**
|
||
|
* @var string
|
||
|
*/
|
||
|
public $public;
|
||
|
|
||
|
/**
|
||
|
* @var string
|
||
|
*/
|
||
|
protected $protected;
|
||
|
|
||
|
/**
|
||
|
* @var string
|
||
|
*/
|
||
|
private $privateStatic;
|
||
|
|
||
|
/**
|
||
|
* Testfunction
|
||
|
* @param Klasse $objekt
|
||
|
* @return void
|
||
|
*/
|
||
|
public function blablubblol(Klasse $objekt) {
|
||
|
$objekt = new ReflectionObject($objekt);
|
||
|
print $objekt->getName();
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Tests the getDocComment() method
|
||
|
*
|
||
|
* @param array $ray
|
||
|
* @param int $zero
|
||
|
* @return string
|
||
|
* @specialtag
|
||
|
*/
|
||
|
protected function testfunctionWithCamelCase(array $ray, $zero = 0) {
|
||
|
return "bla";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//TestClassForTestsWithReflection ends here.
|
||
|
|
||
|
//create ReflectionClass
|
||
|
$class = new ReflectionClass("TestClassForTestsWithReflection");
|
||
|
|
||
|
//print class name
|
||
|
echo "Information about: " . $class->name . "\n";
|
||
|
|
||
|
//getDocs for all methods
|
||
|
foreach($class->getMethods() as $key=>$method) {
|
||
|
var_dump($method->name, $method->getDocComment());
|
||
|
echo "\n";
|
||
|
}
|
||
|
|
||
|
//getDocs for all properties
|
||
|
foreach($class->getProperties() as $key=>$property) {
|
||
|
var_dump($property->name, $property->getDocComment());
|
||
|
echo "\n";
|
||
|
}
|
||
|
|
||
|
?>
|