Skip to content

Commit

Permalink
Some minor code tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Pichler committed Jan 4, 2017
1 parent 47ab52b commit b5d708e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/main/php/PDepend/Source/AST/ASTArtifact.php
Expand Up @@ -50,7 +50,7 @@
* @copyright 2008-2015 Manuel Pichler. All rights reserved.
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
*/
interface ASTArtifact// extends ASTNode
interface ASTArtifact //extends ASTNode
{
/**
* Returns the artifact name.
Expand Down
19 changes: 1 addition & 18 deletions src/main/php/PDepend/Source/AST/ASTNamespace.php
Expand Up @@ -52,13 +52,6 @@
*/
class ASTNamespace extends AbstractASTArtifact
{
/**
* The namespace name.
*
* @var string
*/
protected $name = '';

/**
* The unique identifier for this function.
*
Expand Down Expand Up @@ -96,20 +89,10 @@ class ASTNamespace extends AbstractASTArtifact
*/
public function __construct($name)
{
$this->name = $name;
parent::__construct($name);
$this->id = spl_object_hash($this);
}

/**
* Returns the namespace name.
*
* @return string
*/
public function getName()
{
return $this->name;
}

/**
* Returns a id for this code node.
*
Expand Down
12 changes: 12 additions & 0 deletions src/main/php/PDepend/Source/AST/AbstractASTArtifact.php
Expand Up @@ -102,6 +102,16 @@ public function __construct($name)
$this->name = $name;
}

/**
* Returns the source image of this ast node.
*
* @return string
*/
public function getImage()
{
return $this->name;
}

/**
* Returns the item name.
*
Expand All @@ -125,6 +135,8 @@ public function setName($name)
$this->name = $name;
}



/**
* Returns a id for this code node.
*
Expand Down
11 changes: 11 additions & 0 deletions src/main/php/PDepend/Source/AST/AbstractASTType.php
Expand Up @@ -381,6 +381,17 @@ public function setTokens(array $tokens)
->store($this->id, $tokens);
}

/**
* @return string
*/
public function getNamespacedName()
{
if (null === $this->namespaceName) {
return $this->name;
}
return sprintf('%s\\%s', $this->namespaceName, $this->name);
}

/**
* Returns the name of the parent namespace.
*
Expand Down

0 comments on commit b5d708e

Please sign in to comment.