mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Remove non-static
This commit is contained in:
@@ -39,7 +39,6 @@ class GeneratorCommand extends Command {
|
|||||||
protected $description = 'Generate a new IDE Helper file.';
|
protected $description = 'Generate a new IDE Helper file.';
|
||||||
|
|
||||||
protected $extra;
|
protected $extra;
|
||||||
protected $extra_nonstatic;
|
|
||||||
protected $onlyExtend;
|
protected $onlyExtend;
|
||||||
protected $helpers;
|
protected $helpers;
|
||||||
|
|
||||||
@@ -61,7 +60,6 @@ class GeneratorCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->extra = \Config::get('laravel-ide-helper::extra');
|
$this->extra = \Config::get('laravel-ide-helper::extra');
|
||||||
$this->extra_nonstatic = \Config::get('laravel-ide-helper::extra_nonstatic');
|
|
||||||
|
|
||||||
if( $this->option('helpers') || (\Config::get('laravel-ide-helper::include_helpers') )){
|
if( $this->option('helpers') || (\Config::get('laravel-ide-helper::include_helpers') )){
|
||||||
$this->helpers = \Config::get('laravel-ide-helper::helper_files');
|
$this->helpers = \Config::get('laravel-ide-helper::helper_files');
|
||||||
@@ -157,17 +155,14 @@ exit('Only to be used as an helper for your IDE');\n\n";
|
|||||||
|
|
||||||
//Only add the methods to the output when the root is not the same as the facade.
|
//Only add the methods to the output when the root is not the same as the facade.
|
||||||
$addOutput = ($root !== $facade);
|
$addOutput = ($root !== $facade);
|
||||||
$output .= $this->getMethods($root, $alias, $usedMethods, true, $addOutput);
|
$output .= $this->getMethods($root, $alias, $usedMethods, $addOutput);
|
||||||
|
|
||||||
if(array_key_exists($alias, $this->extra_nonstatic)){
|
|
||||||
$output .= $this->getMethods($this->extra_nonstatic[$alias], $alias, $usedMethods, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Add extra methods, from other classes (magic static calls)
|
//Add extra methods, from other classes (magic static calls)
|
||||||
if(array_key_exists($alias, $this->extra)){
|
if(array_key_exists($alias, $this->extra)){
|
||||||
$output .= $this->getMethods($this->extra[$alias], $alias, $usedMethods, false);
|
$output .= $this->getMethods($this->extra[$alias], $alias, $usedMethods);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$output .= "}\n\n";
|
$output .= "}\n\n";
|
||||||
|
|
||||||
}catch(\Exception $e){
|
}catch(\Exception $e){
|
||||||
@@ -215,7 +210,7 @@ exit('Only to be used as an helper for your IDE');\n\n";
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
protected function getMethods($classes, $alias, &$usedMethods, $static=true, $addOutput = true){
|
protected function getMethods($classes, $alias, &$usedMethods, $addOutput = true){
|
||||||
if(!is_array($classes)){
|
if(!is_array($classes)){
|
||||||
$classes = array($classes);
|
$classes = array($classes);
|
||||||
}
|
}
|
||||||
@@ -233,7 +228,7 @@ exit('Only to be used as an helper for your IDE');\n\n";
|
|||||||
{
|
{
|
||||||
if(!in_array($method->name, $usedMethods)){
|
if(!in_array($method->name, $usedMethods)){
|
||||||
if($method->isPublic() && $addOutput){
|
if($method->isPublic() && $addOutput){
|
||||||
$output .= $this->parseMethod($method, $alias, $static);
|
$output .= $this->parseMethod($method, $alias);
|
||||||
}
|
}
|
||||||
$usedMethods[] = $method->name;
|
$usedMethods[] = $method->name;
|
||||||
}
|
}
|
||||||
@@ -250,7 +245,7 @@ exit('Only to be used as an helper for your IDE');\n\n";
|
|||||||
* @param string $rootParam
|
* @param string $rootParam
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function parseMethod($method, $alias, $static = true){
|
protected function parseMethod($method, $alias){
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
// Don't add the __clone() functions
|
// Don't add the __clone() functions
|
||||||
@@ -277,7 +272,7 @@ exit('Only to be used as an helper for your IDE');\n\n";
|
|||||||
$phpdoc->appendTag(Tag::createInstance('@static', $phpdoc));
|
$phpdoc->appendTag(Tag::createInstance('@static', $phpdoc));
|
||||||
|
|
||||||
//Write the output, using the DocBlock serializer
|
//Write the output, using the DocBlock serializer
|
||||||
$output .= $serializer->getDocComment($phpdoc) ."\n\t public ".($static ? 'static ' : '')."function ".$method->name."(";
|
$output .= $serializer->getDocComment($phpdoc) ."\n\t public static function ".$method->name."(";
|
||||||
|
|
||||||
$output .= implode($paramsWithDefault, ", ");
|
$output .= implode($paramsWithDefault, ", ");
|
||||||
$output .= "){\r\n";
|
$output .= "){\r\n";
|
||||||
|
|||||||
@@ -44,8 +44,6 @@ return array(
|
|||||||
'Cache' => array('Illuminate\Cache\StoreInterface', 'Illuminate\Cache\Repository'),
|
'Cache' => array('Illuminate\Cache\StoreInterface', 'Illuminate\Cache\Repository'),
|
||||||
'DB' => array('Illuminate\Database\Connection'),
|
'DB' => array('Illuminate\Database\Connection'),
|
||||||
'Queue' => array('Illuminate\Queue\QueueInterface'),
|
'Queue' => array('Illuminate\Queue\QueueInterface'),
|
||||||
),
|
|
||||||
'extra_nonstatic' => array(
|
|
||||||
'Eloquent' => array('Illuminate\Database\Eloquent\Builder', 'Illuminate\Database\Query\Builder'),
|
'Eloquent' => array('Illuminate\Database\Eloquent\Builder', 'Illuminate\Database\Query\Builder'),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user