mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Link to original functions
For faster displaying of the real function implementation.
This commit is contained in:
+2749
-1272
File diff suppressed because it is too large
Load Diff
@@ -60,13 +60,14 @@ class GeneratorCommand extends Command {
|
|||||||
$d->setAllowInherited(true);
|
$d->setAllowInherited(true);
|
||||||
$d->setMethodFilter(\ReflectionMethod::IS_PUBLIC);
|
$d->setMethodFilter(\ReflectionMethod::IS_PUBLIC);
|
||||||
|
|
||||||
$output = "<?php\r\ndie('Only to be used as an helper for your IDE');\n";
|
$output = "<?php die('Only to be used as an helper for your IDE');\n";
|
||||||
|
|
||||||
foreach($aliases as $alias => $className){
|
foreach($aliases as $alias => $className){
|
||||||
|
|
||||||
$d->analyze($className);
|
$d->analyze($className);
|
||||||
$output .= "class $alias extends $className{\r\n";
|
|
||||||
|
|
||||||
|
$output .= " class $alias{\r\n";
|
||||||
|
$output .= "\t/**\n\t * @var $className \$realClass\n\t */\n\t static private \$realClass;\n\n";
|
||||||
$methods = $d->getMethods();
|
$methods = $d->getMethods();
|
||||||
|
|
||||||
foreach ($methods as $method)
|
foreach ($methods as $method)
|
||||||
@@ -83,20 +84,28 @@ class GeneratorCommand extends Command {
|
|||||||
|
|
||||||
$annotations = $method->getAnnotations(array("param"));
|
$annotations = $method->getAnnotations(array("param"));
|
||||||
|
|
||||||
$output .= "/**\n * ".trim($method->description)."\n *\n * @static\n";
|
$description = str_replace("\n", "\n\t * ", trim($method->description));
|
||||||
$params = array();
|
$output .= "\t/**\n\t * ".$description."\n\t *\n\t * @static\n";
|
||||||
|
|
||||||
if(!empty($annotations)){
|
if(!empty($annotations)){
|
||||||
foreach ($annotations as $annotation)
|
foreach ($annotations as $annotation)
|
||||||
{
|
{
|
||||||
$output .=" * @param\t".implode($annotation->values, "\t")."\n";
|
$output .="\t * @param\t".implode($annotation->values, "\t")."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if($returnValue !== "void"){
|
||||||
|
$output .= "\t * @return ".$returnValue."\n";
|
||||||
|
}
|
||||||
|
$output .= "\t */\n\t public static function ".$method->name."(";
|
||||||
|
|
||||||
$output .= " * @return ".$returnValue."\n */\n public static function ".$method->name."(";
|
|
||||||
|
|
||||||
$reflection = $method->getReflectionObject();
|
$reflection = $method->getReflectionObject();
|
||||||
|
$params = array();
|
||||||
|
$paramsWithDefault = array();
|
||||||
|
|
||||||
foreach ($reflection->getParameters() as $param) {
|
foreach ($reflection->getParameters() as $param) {
|
||||||
$paramStr = '$'.$param->getName();
|
$paramStr = '$'.$param->getName();
|
||||||
|
$params[] = $paramStr;
|
||||||
if ($param->isOptional()) {
|
if ($param->isOptional()) {
|
||||||
$default = $param->getDefaultValue();
|
$default = $param->getDefaultValue();
|
||||||
if(is_bool($default)){
|
if(is_bool($default)){
|
||||||
@@ -111,12 +120,11 @@ class GeneratorCommand extends Command {
|
|||||||
|
|
||||||
$paramStr .= " = $default";
|
$paramStr .= " = $default";
|
||||||
}
|
}
|
||||||
$params[] = $paramStr;
|
$paramsWithDefault[] = $paramStr;
|
||||||
}
|
}
|
||||||
$output .= implode($params, ", ");
|
$output .= implode($paramsWithDefault, ", ");
|
||||||
|
|
||||||
|
$output .= "){\r\n\t\t".($returnValue !== "void" ? 'return ' : '')."self::\$realClass->".$method->name."(".implode($params, ", ").");\r\n\t }\n\n";
|
||||||
$output .= "){}\n\n";
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user