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

getTokens() public method

Returns an array with all tokens within this file.
public getTokens ( ) : array(array)
return array(array)
    public function getTokens()
    {
        return (array) $this->cache->type('tokens')->restore($this->getId());
    }

Usage Example

 /**
  * testGetTokensDelegatesCallToCacheRestoreWithFileId
  *
  * @return void
  */
 public function testGetTokensDelegatesCallToCacheRestoreWithFileId()
 {
     $cache = $this->createCacheFixture();
     $cache->expects($this->once())->method('type')->with(self::equalTo('tokens'))->will($this->returnValue($cache));
     $cache->expects($this->once())->method('restore')->with(self::equalTo(__FUNCTION__));
     $compilationUnit = new ASTCompilationUnit(null);
     $compilationUnit->setCache($cache);
     $compilationUnit->setId(__FUNCTION__);
     $compilationUnit->getTokens();
 }