Add getShortName

For #106
This commit is contained in:
Barry vd. Heuvel
2014-08-26 10:48:29 +02:00
parent 6c18c3f39a
commit 4fc9c671e8
+9 -3
View File
@@ -12,11 +12,11 @@ namespace Barryvdh\LaravelIdeHelper;
class Alias
{
protected $alias;
protected $facade;
protected $extends = null;
protected $classType = 'class';
protected $short;
protected $namespace = '__root';
protected $root = null;
protected $classes = array();
@@ -42,7 +42,6 @@ class Alias
$facade = '\\' . ltrim($facade, '\\');
$this->facade = $facade;
$this->detectRoot();
if ((!$this->isTrait() && $this->root)) {
@@ -55,7 +54,6 @@ class Alias
$this->detectNamespace();
$this->detectClassType();
}
/**
@@ -114,6 +112,12 @@ class Alias
return $this->alias;
}
/**
* Return the short name (without namespace)
*/
public function getShortName(){
return $this->short;
}
/**
* Get the namespace from the alias
*
@@ -145,6 +149,8 @@ class Alias
$nsParts = explode('\\', $this->alias);
$this->short = array_pop($nsParts);
$this->namespace = implode('\\', $nsParts);
}else{
$this->short = $this->alias;
}
}