Esempio n. 1
0
 /**
  * Extracts all tokens from this file and initializes the iterator used to
  * walk through this file.
  *
  * @param string $contents The text to parse into tokens.
  * @param string $filename The path of this file, if present.
  *
  * @return DocBlox_Reflection_TokenIterator
  */
 public function initializeTokens($contents, $filename = null)
 {
     $this->debug('Started splitting the file into tokens');
     $tokens = token_get_all($contents);
     $this->debug(count($tokens) . ' tokens found in class ' . $this->getName());
     $tokens = new DocBlox_Reflection_TokenIterator($tokens);
     if ($filename != null) {
         $tokens->setFilename($filename);
     }
     $this->debug('Imported tokens into the Iterator');
     return $tokens;
 }