added UsageInformationTrait / INterface + updated mindediversion

This commit is contained in:
kremsy
2017-03-26 12:56:44 +02:00
parent de3bae9029
commit 46daaee61a
7 changed files with 81 additions and 55 deletions

View File

@ -0,0 +1,41 @@
<?php
namespace ManiaControl\General;
use ReflectionClass;
/**
* Class DumpTrait Trait for Implementing the Methods for the UsageInformationAble Interface
*
* @package ManiaControl\General
*/
trait UsageInformationTrait {
/**
* Gets Information about the Class, and a List of the Public Method
*/
public function getUsage() {
$reflection = new ReflectionClass(get_class($this));
echo $reflection->getDocComment();
echo "\nStructure Name of Class = " . get_class($this);
echo "\n\nMethods:";
$methods = array_reverse($reflection->getMethods());
foreach ($methods as $key => $value) {
/** @var \ReflectionMethod $value */
//Don't print the Constructor
if ($value->isPublic() && $value->getName() != "__construct" && $value->getName() != "getUsage") {
echo "\n";
echo preg_replace('/\t/', '', $value->getDocComment());
echo "\n \$result = " . $value->getName() . "(); \n";
$parameters = $value->getParameters();
foreach ($parameters as $parameter) {
echo $parameter . "\n";
}
}
}
echo "\n";
//TODO add public Constands and Properties
}
}