Пример #1
0
 /**
  * @param ClassNode $node
  *
  * @return bool
  */
 protected function isTest(ClassNode $node)
 {
     if ('Test' === substr($node->getImage(), -4, 4)) {
         return true;
     }
     return false;
 }
 /**
  * @param ClassNode|ASTClass $node
  *
  * @return bool
  */
 private function isController(ClassNode $node)
 {
     if (true === $node->isAbstract()) {
         return false;
     }
     if ('Controller' === substr($node->getImage(), -10, 10)) {
         return true;
     }
     return false;
 }
Пример #3
0
 /**
  * This method checks that the given property postfix is accessed on an
  * instance or static reference to the given class.
  *
  * @param \PHPMD\Node\ClassNode $class
  * @param \PHPMD\Node\ASTNode $postfix
  * @return boolean
  */
 protected function isInScopeOfClass(ClassNode $class, ASTNode $postfix)
 {
     $owner = $postfix->getParent()->getChild(0);
     if ($owner->isInstanceOf('PropertyPostfix')) {
         $owner = $owner->getParent()->getParent()->getChild(0);
     }
     return $owner->isInstanceOf('SelfReference') || $owner->isInstanceOf('StaticReference') || strcasecmp($owner->getImage(), '$this') === 0 || strcasecmp($owner->getImage(), $class->getImage()) === 0;
 }
Пример #4
0
 /**
  * This method checks that the given method postfix is accessed on an
  * instance or static reference to the given class.
  *
  * @param \PHPMD\Node\ClassNode $class
  * @param \PHPMD\Node\ASTNode $postfix
  * @return boolean
  */
 private function isClassScope(ClassNode $class, ASTNode $postfix)
 {
     $owner = $postfix->getParent()->getChild(0);
     return $owner->isInstanceOf('MethodPostfix') || $owner->isInstanceOf('SelfReference') || $owner->isInstanceOf('StaticReference') || strcasecmp($owner->getImage(), '$this') === 0 || strcasecmp($owner->getImage(), $class->getImage()) === 0;
 }