예제 #1
0
 /**
  * This method collects all local variable instances from the given 
  * method/function node and stores their image in the <b>$_images</b>
  * property.
  *
  * @param PHP_PMD_Node_AbstractCallable $node The currently
  *        analyzed method/function node.
  *
  * @return void
  */
 private function _collectVariables(PHP_PMD_Node_AbstractCallable $node)
 {
     foreach ($node->findChildrenOfType('Variable') as $variable) {
         if ($this->isLocal($variable)) {
             $this->_collectVariable($variable);
         }
     }
     foreach ($node->findChildrenOfType('VariableDeclarator') as $variable) {
         $this->_collectVariable($variable);
     }
 }
 /**
  * This method collects all local variable instances from the given 
  * method/function node and stores their image in the <b>$_images</b>
  * property.
  *
  * @param PHP_PMD_Node_AbstractCallable $node The currently
  *        analyzed method/function node.
  *
  * @return void
  */
 private function collectVariables(PHP_PMD_Node_AbstractCallable $node)
 {
     foreach ($node->findChildrenOfType('Variable') as $variable) {
         if ($this->isLocal($variable)) {
             $this->collectVariable($variable);
         }
     }
     foreach ($node->findChildrenOfType('VariableDeclarator') as $variable) {
         $this->collectVariable($variable);
     }
     foreach ($node->findChildrenOfType('FunctionPostfix') as $func) {
         if ($func->getImage() === 'compact') {
             foreach ($func->findChildrenOfType('Literal') as $literal) {
                 $this->collectLiteral($literal);
             }
         }
     }
 }