Esempio n. 1
0
 /**
  * testGetImageDelegatesToGetImageMethodOfWrappedNode
  *
  * @return void
  * @covers PHP_PMD_Node_ASTNode
  * @group phpmd
  * @group phpmd::node
  * @group unittest
  */
 public function testGetImageDelegatesToGetImageMethodOfWrappedNode()
 {
     $mock = $this->getMock('PHP_Depend_Code_ASTNode');
     $mock->expects($this->once())->method('getImage');
     $node = new PHP_PMD_Node_ASTNode($mock, __FILE__);
     $node->getImage();
 }
Esempio n. 2
0
 /**
  * Stores the given variable node in an internal list of found variables.
  *
  * @param PHP_PMD_Node_ASTNode $node The context variable node.
  *
  * @return void
  */
 private function _collectVariable(PHP_PMD_Node_ASTNode $node)
 {
     if (!isset($this->_images[$node->getImage()])) {
         $this->_images[$node->getImage()] = array();
     }
     $this->_images[$node->getImage()][] = $node;
 }
Esempio n. 3
0
 /**
  * This method removes the field from the <b>$_fields</b> property that is
  * accessed through the given property postfix node.
  *
  * @param PHP_PMD_Node_ASTNode $postfix The context postfix node.
  *
  * @return void
  */
 private function _removeUsedField(PHP_PMD_Node_ASTNode $postfix)
 {
     // TODO: Change this to isStatic() when PHP_Depend 0.9.9 is available
     if ($postfix->getParent()->getImage() === '::') {
         $image = $postfix->getImage();
     } else {
         $image = '$' . $postfix->getImage();
     }
     unset($this->_fields[$image]);
 }
 /**
  * Stores the given literal node in an internal list of found variables.
  *
  * @param PHP_PMD_Node_ASTNode $node The context variable node.
  *
  * @return void
  */
 private function collectLiteral(PHP_PMD_Node_ASTNode $node)
 {
     $variable = '$' . trim($node->getImage(), '\'');
     if (!isset($this->images[$variable])) {
         $this->images[$variable] = array();
     }
     $this->images[$variable][] = $node;
 }