Exemple #1
0
 /**
  * Returns array for possible exportable objects
  *
  * @param array $array
  *
  * @return mixed[]
  */
 protected function resolveArray(array $array)
 {
     foreach ($array as $index => $item) {
         if ($this->sharedIdToSplHash && is_object($item) && isset($this->sharedIdToSplHash[spl_object_hash($item)])) {
             $id = $this->sharedIdToSplHash[spl_object_hash($item)];
             $array[$index] = $this->builder->this()->shared($id)->end();
         }
         if ($item instanceof ExportableInterface) {
             $array[$index] = $this->build($item);
         }
         if (is_array($item)) {
             $array[$index] = $this->resolveArray($item);
         }
     }
     return $array;
 }
Exemple #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->createAnalyzers($this->options);
     $collection = CollectionArtifactFilter::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 AnalyzerFilterAware) {
             $collection->setFilter($this->codeFilter);
         }
         $analyzer->analyze($this->builder->getNamespaces());
         // Remove filters if this analyzer is filter aware
         $collection->setFilter();
         foreach ($this->generators as $logger) {
             $logger->log($analyzer);
         }
     }
     ini_restore('xdebug.max_nesting_level');
     $this->fireEndAnalyzeProcess();
 }
 /**
  * Extracts documented <b>throws</b> and <b>return</b> types and sets them
  * to the given <b>$callable</b> instance.
  *
  * @param  \PDepend\Source\AST\AbstractASTCallable $callable
  * @return void
  */
 private function prepareCallable(AbstractASTCallable $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));
     }
 }
 /**
  * This method can be used to register an existing interface in the current
  * class context.
  *
  * @param  \PDepend\Source\AST\ASTInterface $interface
  * @return void
  */
 public function registerInterface(ASTInterface $interface)
 {
     self::$builder->restoreInterface($interface);
 }