Пример #1
0
 /**
  * testCreateReturnsDifferentInstancesForDifferentCacheNames
  *
  * @return void
  */
 public function testCreateReturnsDifferentInstancesForDifferentCacheNames()
 {
     $factory = new PHP_Depend_Util_Cache_Factory($this->createConfigurationFixture());
     $cache0 = $factory->create();
     $cache1 = $factory->create(__FUNCTION__);
     self::assertNotSame($cache0, $cache1);
 }
Пример #2
0
 /**
  * Creates a {@link PHP_Depend_Metrics_AnalyzerLoader} instance that will be
  * used to create all analyzers required for the actually registered logger
  * instances.
  *
  * @param array $options The command line options recieved for this run.
  *
  * @return PHP_Depend_Metrics_AnalyzerLoader
  */
 private function createAnalyzerLoader(array $options)
 {
     $analyzerSet = array();
     foreach ($this->loggers as $logger) {
         foreach ($logger->getAcceptedAnalyzers() as $type) {
             // Check for type existence
             if (in_array($type, $analyzerSet) === false) {
                 $analyzerSet[] = $type;
             }
         }
     }
     $cacheKey = md5(serialize($this->files) . serialize($this->directories));
     $loader = new PHP_Depend_Metrics_AnalyzerLoader(new PHP_Depend_Metrics_AnalyzerClassFileSystemLocator(), $this->cacheFactory->create($cacheKey), $analyzerSet, $options);
     return $this->initAnalyseListeners($loader);
 }
Пример #3
0
 /**
  * This method performs the parsing process of all source files. It expects
  * that the <b>$_builder</b> property was initialized with a concrete builder
  * implementation.
  *
  * @return void
  */
 private function _performParseProcess()
 {
     // Reset list of thrown exceptions
     $this->_parseExceptions = array();
     // Create a cache instance
     $cacheFactory = new PHP_Depend_Util_Cache_Factory($this->configuration);
     $cache = $cacheFactory->create();
     $tokenizer = new PHP_Depend_Tokenizer_Internal();
     $this->fireStartParseProcess($this->_builder);
     foreach ($this->_createFileIterator() as $file) {
         $tokenizer->setSourceFile($file);
         $parser = new PHP_Depend_Parser_VersionAllParser($tokenizer, $this->_builder, $cache);
         $parser->setMaxNestingLevel(1024);
         // Disable annotation parsing?
         if ($this->_withoutAnnotations === true) {
             $parser->setIgnoreAnnotations();
         }
         $this->fireStartFileParsing($tokenizer);
         try {
             $parser->parse();
         } catch (PHP_Depend_Parser_Exception $e) {
             $this->_parseExceptions[] = $e;
         }
         $this->fireEndFileParsing($tokenizer);
     }
     $this->fireEndParseProcess($this->_builder);
 }