mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 18:13:11 +00:00
Get classes from managers
This commit is contained in:
@@ -157,6 +157,12 @@ exit('Only to be used as an helper for your IDE');\n\n";
|
|||||||
$addOutput = ($root !== $facade);
|
$addOutput = ($root !== $facade);
|
||||||
$output .= $this->getMethods($root, $alias, $usedMethods, $addOutput);
|
$output .= $this->getMethods($root, $alias, $usedMethods, $addOutput);
|
||||||
|
|
||||||
|
|
||||||
|
$driver = $this->getDriver($alias);
|
||||||
|
if($driver){
|
||||||
|
$output .= $this->getMethods($driver, $alias, $usedMethods);
|
||||||
|
}
|
||||||
|
|
||||||
//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);
|
$output .= $this->getMethods($this->extra[$alias], $alias, $usedMethods);
|
||||||
@@ -217,6 +223,22 @@ exit('Only to be used as an helper for your IDE');\n\n";
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDriver($alias){
|
||||||
|
if($alias == "Auth"){
|
||||||
|
$driver = \Auth::driver();
|
||||||
|
}elseif($alias == "DB"){
|
||||||
|
$driver = \DB::connection();
|
||||||
|
}elseif($alias == "Cache"){
|
||||||
|
$driver = \Cache::driver();
|
||||||
|
}elseif($alias == "Queue"){
|
||||||
|
$driver = \Queue::connection();
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return get_class($driver);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the methods for one or multiple classes.
|
* Get the methods for one or multiple classes.
|
||||||
*
|
*
|
||||||
@@ -244,7 +266,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( $addOutput){
|
if( $addOutput){
|
||||||
$output .= $this->parseMethod($method, $alias);
|
$output .= $this->parseMethod($method, $alias, $reflection);
|
||||||
}
|
}
|
||||||
$usedMethods[] = $method->name;
|
$usedMethods[] = $method->name;
|
||||||
}
|
}
|
||||||
@@ -259,7 +281,7 @@ exit('Only to be used as an helper for your IDE');\n\n";
|
|||||||
* @param string $alias
|
* @param string $alias
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function parseMethod($method, $alias){
|
protected function parseMethod($method, $alias, $class){
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
// Don't add the __clone() functions
|
// Don't add the __clone() functions
|
||||||
@@ -296,9 +318,14 @@ exit('Only to be used as an helper for your IDE');\n\n";
|
|||||||
|
|
||||||
//Reference the 'real' function in the declaringclass
|
//Reference the 'real' function in the declaringclass
|
||||||
$declaringClass = $method->getDeclaringClass();
|
$declaringClass = $method->getDeclaringClass();
|
||||||
|
if($declaringClass->isAbstract()){
|
||||||
|
$declaringClass = $class;
|
||||||
|
}
|
||||||
|
|
||||||
$constructor = $declaringClass->getConstructor();
|
$constructor = $declaringClass->getConstructor();
|
||||||
$root = $declaringClass->getName();
|
$root = $declaringClass->getName();
|
||||||
|
|
||||||
|
|
||||||
$output .= "\t\t\$root = new \\$root(";
|
$output .= "\t\t\$root = new \\$root(";
|
||||||
if(!is_null($constructor)){
|
if(!is_null($constructor)){
|
||||||
$constructorParams = array();
|
$constructorParams = array();
|
||||||
|
|||||||
@@ -40,10 +40,6 @@ return array(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
'extra' => array(
|
'extra' => array(
|
||||||
'Auth' => array('Illuminate\Auth\Guard'),
|
|
||||||
'Cache' => array('Illuminate\Cache\StoreInterface', 'Illuminate\Cache\Repository'),
|
|
||||||
'DB' => array('Illuminate\Database\Connection'),
|
|
||||||
'Queue' => array('Illuminate\Queue\QueueInterface'),
|
|
||||||
'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