PDepend\Source\AST\ASTCompilationUnit::getStartLine PHP Method

getStartLine() public method

Returns the start line number for this source file. For an existing file this value must always be 1, while it can be 0 for a not existing dummy file.
Since: 0.10.0
public getStartLine ( ) : integer
return integer
    public function getStartLine()
    {
        if ($this->startLine === 0) {
            $this->readSource();
        }
        return $this->startLine;
    }

Usage Example

 /**
  * testGetStartLineReturnsOneWhenSourceFileExists
  *
  * @return void
  */
 public function testGetStartLineReturnsOneWhenSourceFileExists()
 {
     $file = new ASTCompilationUnit(__FILE__);
     $this->assertEquals(1, $file->getStartLine());
 }