/** * @param MethodNode|ASTMethod $node * * @return bool */ private function hasCorrectPrefix(MethodNode $node) { foreach ($this->allowedPrefixes as $prefix) { if ($prefix === substr($node->getImage(), 0, strlen($prefix))) { return true; } } return false; }
/** * Returns <b>true</b> when the given method should be used for this rule's * analysis. * * @param \PHPMD\Node\ClassNode $class * @param \PHPMD\Node\MethodNode $method * @return boolean */ private function acceptMethod(ClassNode $class, MethodNode $method) { return $method->isPrivate() && false === $method->hasSuppressWarningsAnnotationFor($this) && strcasecmp($method->getImage(), $class->getImage()) !== 0 && strcasecmp($method->getImage(), '__construct') !== 0 && strcasecmp($method->getImage(), '__destruct') !== 0 && strcasecmp($method->getImage(), '__clone') !== 0; }
/** * Tests if the given method starts with <b>get</b> or <b>_get</b>. * * @param \PHPMD\Node\MethodNode $node * @return boolean */ private function isGetterMethodName(MethodNode $node) { return preg_match('(^_?get)i', $node->getImage()) > 0; }