getFileName() public method

Returns the physical file name for this object.
public getFileName ( ) : string
return string
Beispiel #1
0
 /**
  * Parse a statement.
  *
  * @return \PDepend\Source\AST\ASTNode
  * @throws \PDepend\Source\Parser\UnexpectedTokenException
  * @since  1.0.0
  */
 private function parseStatement()
 {
     if (null === ($stmt = $this->parseOptionalStatement())) {
         throw new UnexpectedTokenException($this->tokenizer->next(), $this->compilationUnit->getFileName());
     }
     return $stmt;
 }
Beispiel #2
0
 /**
  * Generates an identifier for the given file instance.
  *
  * @param  \PDepend\Source\AST\ASTCompilationUnit $compilationUnit
  * @return string
  */
 public function forFile(ASTCompilationUnit $compilationUnit)
 {
     return $this->hash($compilationUnit->getFileName());
 }
 /**
  * Parse a statement.
  *
  * @return \PDepend\Source\AST\ASTNode
  * @throws \PDepend\Source\Parser\UnexpectedTokenException
  * @throws \PDepend\Source\Parser\EndOfTokenStreamException
  * @since  1.0.0
  */
 private function parseStatement()
 {
     if (is_object($stmt = $this->parseOptionalStatement())) {
         return $stmt;
     }
     if (is_object($token = $this->tokenizer->next())) {
         throw new UnexpectedTokenException($token, $this->compilationUnit->getFileName());
     }
     throw new EndOfTokenStreamException($this->compilationUnit->getFileName());
 }
Beispiel #4
0
 /**
  * Visits a file node.
  *
  * @param  \PDepend\Source\AST\ASTCompilationUnit $compilationUnit
  * @return void
  */
 public function visitCompilationUnit(ASTCompilationUnit $compilationUnit)
 {
     // Skip for dummy files
     if ($compilationUnit->getFileName() === null) {
         return;
     }
     // Check for initial file
     $id = $compilationUnit->getId();
     if (isset($this->metrics[$id])) {
         return;
     }
     $this->fireStartFile($compilationUnit);
     if ($this->restoreFromCache($compilationUnit)) {
         $this->updateProjectMetrics($id);
         return $this->fireEndFile($compilationUnit);
     }
     list($cloc, $eloc, $lloc) = $this->linesOfCode($compilationUnit->getTokens());
     $loc = $compilationUnit->getEndLine();
     $ncloc = $loc - $cloc;
     $this->metrics[$id] = array(self::M_LINES_OF_CODE => $loc, self::M_COMMENT_LINES_OF_CODE => $cloc, self::M_EXECUTABLE_LINES_OF_CODE => $eloc, self::M_LOGICAL_LINES_OF_CODE => $lloc, self::M_NON_COMMENT_LINES_OF_CODE => $ncloc);
     $this->updateProjectMetrics($id);
     $this->fireEndFile($compilationUnit);
 }
 /**
  * testGetFileNameReturnsTheFileName
  *
  * @return void
  */
 public function testGetFileNameReturnsTheFileName()
 {
     $file = new ASTCompilationUnit(__FILE__);
     $this->assertEquals(__FILE__, $file->getFileName());
 }