/** * @param MethodNode $node * * @return int */ private function count(MethodNode $node) { $count = 0; $methodPostfixes = $node->findChildrenOfType('MethodPostfix'); foreach ($methodPostfixes as $methodPostfix) { if (true === $this->isMethodPostfixInNames($methodPostfix)) { $count++; } } return $count; }
/** * @param MethodNode $node * * @return bool */ private function hasNotAllowedChildren(MethodNode $node) { $children = $node->findChildrenOfType('ScopeStatement'); $allowedChildren = explode($this->getStringProperty('delimiter'), $this->getStringProperty('allowedChildren')); /** @var AbstractNode $child */ foreach ($children as $child) { if (true === in_array($child->getImage(), $allowedChildren) || true === $this->isChildOfTry($child)) { continue; } return true; } return false; }
/** * @param MethodNode $node * * @return int */ private function countThis(MethodNode $node) { $count = 0; $variables = $node->findChildrenOfType('Variable'); foreach ($variables as $variable) { if ($variable->getImage() === '$this') { $count++; } } return $count; }