/**
  * Returns the concrete type instance associated with with this placeholder.
  *
  * @return PHP_Depend_Code_AbstractClassOrInterface
  */
 public function getType()
 {
     if ($this->typeInstance === null) {
         $this->typeInstance = $this->builder->getClassOrInterface($this->getImage());
     }
     return $this->typeInstance;
 }
Beispiel #2
0
 /**
  * This method performs the analysing process of the parsed source files. It
  * creates the required analyzers for the registered listeners and then
  * applies them to the source tree.
  *
  * @return void
  */
 private function performAnalyzeProcess()
 {
     $analyzerLoader = $this->createAnalyzerLoader($this->options);
     $collection = PHP_Depend_Code_Filter_Collection::getInstance();
     $this->fireStartAnalyzeProcess();
     ini_set('xdebug.max_nesting_level', $this->configuration->parser->nesting);
     foreach ($analyzerLoader as $analyzer) {
         // Add filters if this analyzer is filter aware
         if ($analyzer instanceof PHP_Depend_Metrics_FilterAwareI) {
             $collection->setFilter($this->codeFilter);
         }
         $analyzer->analyze($this->builder->getPackages());
         // Remove filters if this analyzer is filter aware
         $collection->setFilter();
         foreach ($this->loggers as $logger) {
             $logger->log($analyzer);
         }
     }
     ini_restore('xdebug.max_nesting_level');
     $this->fireEndAnalyzeProcess();
 }
Beispiel #3
0
 /**
  * Extracts documented <b>throws</b> and <b>return</b> types and sets them
  * to the given <b>$callable</b> instance.
  *
  * @param PHP_Depend_Code_AbstractCallable $callable The context callable.
  *
  * @return void
  */
 private function _prepareCallable(PHP_Depend_Code_AbstractCallable $callable)
 {
     // Skip, if ignore annotations is set
     if ($this->_ignoreAnnotations === true) {
         return;
     }
     // Get all @throws Types
     $throws = $this->_parseThrowsAnnotations($callable->getDocComment());
     foreach ($throws as $qualifiedName) {
         $callable->addExceptionClassReference($this->builder->buildASTClassOrInterfaceReference($qualifiedName));
     }
     // Get return annotation
     $qualifiedName = $this->_parseReturnAnnotation($callable->getDocComment());
     if ($qualifiedName !== null) {
         $callable->setReturnClassReference($this->builder->buildASTClassOrInterfaceReference($qualifiedName));
     }
 }
Beispiel #4
0
 /**
  * This method can be used to register an existing interface in the current
  * class context.
  *
  * @param PHP_Depend_Code_Interface $interface The interface instance.
  *
  * @return void
  */
 public function registerInterface(PHP_Depend_Code_Interface $interface)
 {
     self::$builder->restoreInterface($interface);
 }
Beispiel #5
0
 /**
  * This method performs the analysing process of the parsed source files. It
  * creates the required analyzers for the registered listeners and then
  * applies them to the source tree.
  *
  * @return void
  */
 private function _performAnalyzeProcess()
 {
     $analyzerLoader = $this->_createAnalyzerLoader($this->_options);
     $collection = PHP_Depend_Code_Filter_Collection::getInstance();
     $this->fireStartAnalyzeProcess();
     foreach ($analyzerLoader as $analyzer) {
         // Add filters if this analyzer is filter aware
         if ($analyzer instanceof PHP_Depend_Metrics_FilterAwareI) {
             $collection->addFilter($this->_codeFilter);
         }
         $analyzer->analyze($this->_builder->getPackages());
         // Remove filters if this analyzer is filter aware
         if ($analyzer instanceof PHP_Depend_Metrics_FilterAwareI) {
             $collection->removeFilter($this->_codeFilter);
         }
         foreach ($this->_loggers as $logger) {
             $logger->log($analyzer);
         }
     }
     $this->fireEndAnalyzeProcess();
 }