@param \PHPMD\Node\MethodNode $method

@return void
163749
protected function applyNoLoopsInMethod(MethodNode $method)
    {
        foreach ($method->findChildrenOfType('Statement') as $statement) {
            if (!in_array(strtolower($statement->getImage()), $this->forbiddenStatements)) {
                continue;
            }

            $message = sprintf(
                'The method %s contains a "%s" statement which violates rule "' . static::RULE . '"',
                $method->getFullQualifiedName(),
                $statement->getImage()
            );

            $this->addViolation($method, [$message]);
        }
    }
453137
protected function applyRule(MethodNode $node)
    {
        $comment = $node->getComment();
        if ($this->hasInvalidReturnType($comment)) {
            $class = $node->getParentName();
            $method = $node->getName();
            $fullClassName = $node->getFullQualifiedName();

            $message = sprintf(
                '%s (%s) returns a concrete class which violates the rule "%s"',
                "{$class}::{$method}()",
                $fullClassName,
                static::RULE
            );

            $this->addViolation($node, [$message]);
        }
    }
122548
protected function setMethod($method)
    {
        switch (strtoupper($method)) {
            case 'HEAD':
                curl_setopt($this->request, CURLOPT_NOBODY, true);
                break;
            case 'GET':
                curl_setopt($this->request, CURLOPT_HTTPGET, true);
                break;
            case 'POST':
                curl_setopt($this->request, CURLOPT_POST, true);
                break;
            default:
                curl_setopt($this->request, CURLOPT_CUSTOMREQUEST, $method);
        }
    }
475324
public function apply(AbstractNode $node): void
    {
        if (!$this->isPlugin($node)) {
            return;
        }

        $pluginMethods = $node->getMethods();

        foreach ($pluginMethods as $pluginMethod) {
            $this->applyRule($pluginMethod);
        }
    }
287277
private function isMethodCall(Node\Node $node, string $objectName, string $methodName): bool
    {
        if ($node instanceof Node\CallExpression) {
            $callee = $node->getCallee();

            if ($callee instanceof Node\MemberExpression) {
                $object = $callee->getObject();
                $property = $callee->getProperty();

                if ($object instanceof Node\Identifier && $property instanceof Node\Identifier) {
                    return $object->getName() === $objectName && $property->getName() === $methodName;
                }
            }
        }

        return false;
    }
398024
public function remove($method, $route)
	{
		if (!array_key_exists($method, $this->routes)) {
			return;
		}

		foreach ($this->routes[$method] as $key => $entry) {
			if ($entry->route == $route) {
				unset($this->routes[$method][$key]);
			}
		}

		if (count($this->routes[$method]) == 0) {
			unset($this->routes[$method]);
		}
	}
101596
public function addMethod(&$method)
    {
        if (isset($this->_methods[$method->name()])) {
            $phpdoctor =& $this->_root->phpdoctor();
            echo "\n";
            $phpdoctor->warning('Found method '.$method->name().' again, overwriting previous version');
        }
        $this->_methods[$method->name()] =& $method;
    }
1073772
public function setMethod($method)
    {
        $method = (string) $method;
        if ($method === '') {
            throw new \InvalidArgumentException('$method cannot be empty');
        }

        $this->method = $method;
    }
740653
public function setSelectionMethod($method)
    {
        if (!defined('self::SELECT_'.strtoupper($method))) {
            throw new InvalidArgumentException(sprintf('Selection method "%s" is unknown.', $method));
        }

        $this->selectionMethod = strtolower($method);
    }
1188450
public function setMethod($method) {
        $method = (int) $method;
        switch ($this->method) {
            case self::METHOD_AUTO:
            case self::METHOD_GET:
            case self::METHOD_POST:
                $this->method = $method;
                break;
            default:
                throw new InvalidArgumentException();
        }
    }
464332
protected function checkStatements(MethodNode $method)
    {
        $factoryCalls = $this->getFactoryCallsNumber($method);
        if ($factoryCalls < 2) {
            return;
        }

        $message = sprintf(
            'The method %s has %s factory calls and violates the rule "%s".',
            $method->getFullQualifiedName(),
            $factoryCalls,
            static::RULE
        );

        $this->addViolation($method, [$message]);
    }
483563
public function method(string $method, string ...$methods): self
    {
        array_unshift($methods, $method);

        return $this->setAllowedMethods($methods);
    }
821918
private function init($method)
    {
        if (is_string($method) && method_exists($this, $method))
        {
            return $this->$method();
        }

        return $method();
    }
1275878
public function apply(AbstractNode $node): void
    {
        if (!$this->isRepository($node)) {
            return;
        }

        $classNodeTransfer = $this->getClassNodeTransfer($node);

        try {
            $methodTransferCollection = $this->getFacade()->getMethodTransferCollectionWithRelations($classNodeTransfer);
        } catch (InvalidArgumentException $e) {
            /*
             * DocBlock exception Spryker\Zed\SalesStatistics\Persistence\SalesStatisticsRepository::getDataTopOrderStatistic()
             * Delete try\catch block after fix
             */
            return;
        }

        if ($methodTransferCollection === []) {
            return;
        }

        $moduleTransfers = $this->getFacade()->getModuleTransfers($methodTransferCollection, $classNodeTransfer);

        $tableTransferCollection = $this->getFacade()->getTableTransfers($moduleTransfers, $classNodeTransfer);

        foreach ($methodTransferCollection as $methodTransfer) {
            $this->applyRule($methodTransfer, $tableTransferCollection, $classNodeTransfer);
        }
    }
1048545
protected function validateMethod($method) : void
	{
		if (! \is_string($method))
		{
			throw new \InvalidArgumentException('HTTP method must be a string');
		}
		else if (! \preg_match(HeaderInterface::RFC7230_TOKEN, $method))
		{
			throw new \InvalidArgumentException(\sprintf('The given method "%s" is not valid', $method));
		}
	}
552011
protected function applyRule(MethodNode $node): void
    {
        if ($node->isPublic()) {
            return;
        }

        $method = $node->getName();

        $message = sprintf(
            'The factory method \'%s()\' is not public which violates the rule "%s"',
            $method,
            static::RULE
        );

        $this->addViolation($node, [$message]);
    }
450213
protected function applyRule(MethodNode $method)
    {
        foreach ($method->findChildrenOfType('Statement') as $statement) {
            $this->checkForbiddenStatement($method, $statement);
            $this->checkSwitchStatement($method, $statement);
        }
    }