예제 #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);
     }
 }
예제 #2
0
파일: Method.php 프로젝트: zerkalica/phpmd
 /**
  * Checks if this node has a suppressed annotation for the given rule
  * instance.
  *
  * @param PHP_PMD_Rule $rule The context rule instance.
  *
  * @return boolean
  */
 public function hasSuppressWarningsAnnotationFor(PHP_PMD_Rule $rule)
 {
     if (parent::hasSuppressWarningsAnnotationFor($rule)) {
         return true;
     }
     return $this->getParentType()->hasSuppressWarningsAnnotationFor($rule);
 }
 /**
  * Constructs a new function wrapper.
  *
  * @param PHP_Depend_Code_Function $node The wrapped function object.
  */
 public function __construct(PHP_Depend_Code_Function $node)
 {
     parent::__construct($node);
 }
예제 #4
0
파일: Function.php 프로젝트: n2bh/phpmd
 /**
  * Constructs a new function wrapper.
  *
  * @param PDepend $node The wrapped function object.
  */
 public function __construct(ASTFunction $node)
 {
     parent::__construct($node);
 }
 /**
  * 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);
             }
         }
     }
 }