Inheritance: implements PDepend\Source\Builder\Builder
 /**
  * Parses the given test file and then returns the builder instance.
  *
  * @param string $file Relative path to a test file for the calling test.
  * @return \PDepend\Source\Builder\Builder
  */
 protected function parseSourceAndReturnBuilder($file)
 {
     copy(self::createCodeResourceUriForTest() . '/' . $file, $this->testFile);
     $cache = new FileCacheDriver($this->cacheDir);
     $tokenizer = new PHPTokenizerInternal();
     $tokenizer->setSourceFile($this->testFile);
     $builder = new PHPBuilder();
     $builder->setCache($cache);
     $parser = new PHPParserGeneric($tokenizer, $builder, $cache);
     $parser->parse();
     return $builder;
 }
 /**
  * Creates a clean builder test instance.
  *
  * @return \PDepend\Source\Language\PHP\PHPBuilder
  */
 protected function createBuilder()
 {
     $builder = new PHPBuilder();
     $builder->setCache($this->createCacheFixture());
     return $builder;
 }
 /**
  * Parses the given source file or directory with the default tokenizer
  * and node builder implementations.
  *
  * @param string  $fileOrDirectory
  * @param boolean $ignoreAnnotations
  * @return \PDepend\Source\AST\ASTNamespace[]
  */
 public static function parseSource($fileOrDirectory, $ignoreAnnotations = false)
 {
     if (file_exists($fileOrDirectory) === false) {
         $fileOrDirectory = self::createCodeResourceURI($fileOrDirectory);
     }
     if (is_dir($fileOrDirectory)) {
         $it = new Iterator(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($fileOrDirectory)), new ExcludePathFilter(array('.svn')));
     } else {
         $it = new \ArrayIterator(array($fileOrDirectory));
     }
     $files = array();
     foreach ($it as $file) {
         if (is_object($file)) {
             $files[] = realpath($file->getPathname());
         } else {
             $files[] = $file;
         }
     }
     sort($files);
     $cache = new MemoryCacheDriver();
     $builder = new PHPBuilder();
     foreach ($files as $file) {
         $tokenizer = new PHPTokenizerInternal();
         $tokenizer->setSourceFile($file);
         $parser = new PHPParserGeneric($tokenizer, $builder, $cache);
         if ($ignoreAnnotations === true) {
             $parser->setIgnoreAnnotations();
         }
         $parser->parse();
     }
     return $builder->getNamespaces();
 }