Get the method data for a given method.

@param  \ReflectionMethod  $method
@param  string  $prefix
@return array
435264
public function getMethodData(ReflectionMethod $method, $prefix)
    {
        $verb = $this->getVerb($name = $method->name);
        $uri = $this->addUriWildcards($plain = $this->getPlainUri($name, $prefix));
        return compact('verb', 'plain', 'uri');
    }
1013313
public function offsetGet($method)
        {
            $methods = $this->getConsolidatedMethods();

            if (!isset($methods[$method])) {
                throw new Exception("$method, $this->class");
            }

            return $methods[$method];
        }
1277951
protected function getJsMethod($method)
    {
        $methods = [
            'get' => 'read',
            'post' => 'create',
            'put' => 'update',
            'delete' => 'delete',
        ];
        return isset($methods[strtolower($method)]) ? $methods[strtolower($method)] : 'read';
    }
680973
protected function parseDocBlock(ReflectionMethod $method)
    {
        $comment = $method->getDocComment();
        $phpdoc = new DocBlock($comment);

        return [
            'short' => $phpdoc->getShortDescription(),
            'long' => $phpdoc->getLongDescription()->getContents(),
            'tags' => $phpdoc->getTags(),
        ];
    }
732247
public function getMethodAttribute($method)
    {
        if (is_array($method)) {
            return $method;
        } else {
            if (is_string($method)) {
                $method = (integer)$method;
            }
        }

        return VerbsMask::maskToArray($method);
    }
690892
public static function parseParameters(Method $method) : array
	{
		$taskName = NULL;
		if ($method->hasAnnotation(Parameters::TASK)) {
			$className = $method->getDeclaringClass()->getName();
			$methodName = $method->getName();
			$taskName = $className . ' - ' . $methodName;
		}

		$taskAnnotation = $method->getAnnotation(Parameters::TASK);

		$parameters = [
			static::TASK => is_string($taskAnnotation)
				? Parser::parseName($taskAnnotation)
				: $taskName,
			static::PERIOD => $method->hasAnnotation(Parameters::PERIOD)
				? Parser::parsePeriod((string) $method->getAnnotation(Parameters::PERIOD))
				: NULL,
			static::DAYS => $method->hasAnnotation(Parameters::DAYS)
				? Parser::parseDays((string) $method->getAnnotation(Parameters::DAYS))
				: NULL,
			static::TIME => $method->hasAnnotation(Parameters::TIME)
				? Parser::parseTimes((string) $method->getAnnotation(Parameters::TIME))
				: NULL,
		];

		return $parameters;
	}
251841
protected function getMethodCode($method)
    {
        $reflection = new \ReflectionMethod($this->model, $method);

        $file = new \SplFileObject($reflection->getFileName());
        $file->seek($reflection->getStartLine() - 1);

        $methodCode = '';

        while ($file->key() < $reflection->getEndLine()) {
            $methodCode .= $file->current();

            $file->next();
        }

        $methodCode = trim(preg_replace('/\s\s+/', '', $methodCode));

        $start = strpos($methodCode, 'function(');
        $length = strrpos($methodCode, '}') - $start + 1;

        return substr($methodCode, $start, $length);
    }
743807
protected function getReflectionMethod($class, $method)
    {
        if (!isset($this->methodReflectors[$class])) {
            $this->methodReflectors[$class] = [];
        }
        if (!isset($this->methodReflectors[$class][$method])) {
            $this->methodReflectors[$class][$method] = new \ReflectionMethod($class, $method);
        }

        return $this->methodReflectors[$class][$method];
    }
961816
function getMethodParams($class, $method) {
        if(!is_callable([$class, $method])){
            return self::NOT_CALLABLE;
        }
        $reflectMethod = new \ReflectionMethod($class, $method);
        $params        = [];
        foreach ($reflectMethod->getParameters() as $param) {
            $_param = '$' . $param->getName();
            if ($param->isDefaultValueAvailable()) {
                $default = $param->getDefaultValue();
                switch (mb_strtolower(gettype($default))) {
                    case 'null':
                        $default = 'null';
                        break;
                    case 'array':
                        $default = '[]';
                        break;
                    case 'string':
                        $default = '\'' . $default . '\'';
                        break;
                    case 'boolean':
                        $default = $default ? 'true' : 'false';
                        break;
                    default:
                        $default = $default;
                        break;
                }
                $_param .= ' = ' . $default;
            }
            $params[] = $_param;
        }
        return implode(', ', $params);

    }
401844
public function extractReflectionMethodInfo(\ReflectionMethod $method)
    {
        $method_name = strtolower($method->getName());

        $class_storage = $this->storage_provider->get($method->class);

        if (isset($class_storage->methods[strtolower($method_name)])) {
            return;
        }

        $method_id = $method->class . '::' . $method_name;

        $storage = $class_storage->methods[strtolower($method_name)] = new MethodStorage();

        $storage->cased_name = $method->name;
        $storage->defining_fqcln = $method->class;

        if (strtolower((string)$method->name) === strtolower((string)$method->class)) {
            $this->codebase->methods->setDeclaringMethodId(
                $method->class . '::__construct',
                $method->class . '::' . $method_name
            );
            $this->codebase->methods->setAppearingMethodId(
                $method->class . '::__construct',
                $method->class . '::' . $method_name
            );
        }

        $declaring_class = $method->getDeclaringClass();

        $storage->is_static = $method->isStatic();
        $storage->abstract = $method->isAbstract();

        $class_storage->declaring_method_ids[$method_name] =
            $declaring_class->name . '::' . strtolower((string)$method->getName());

        $class_storage->inheritable_method_ids[$method_name] = $class_storage->declaring_method_ids[$method_name];
        $class_storage->appearing_method_ids[$method_name] = $class_storage->declaring_method_ids[$method_name];
        $class_storage->overridden_method_ids[$method_name] = [];

        try {
            $storage->return_type = CallMap::getReturnTypeFromCallMap($method_id);
            $storage->return_type->queueClassLikesForScanning($this->codebase);
        } catch (\InvalidArgumentException $e) {
            // do nothing
        }

        $storage->visibility = $method->isPrivate()
            ? ClassLikeAnalyzer::VISIBILITY_PRIVATE
            : ($method->isProtected() ? ClassLikeAnalyzer::VISIBILITY_PROTECTED : ClassLikeAnalyzer::VISIBILITY_PUBLIC);

        $possible_params = CallMap::getParamsFromCallMap($method_id);

        if ($possible_params === null) {
            $params = $method->getParameters();

            $storage->params = [];

            /** @var \ReflectionParameter $param */
            foreach ($params as $param) {
                $param_array = $this->getReflectionParamData($param);
                $storage->params[] = $param_array;
                $storage->param_types[$param->name] = $param_array->type;
            }
        } else {
            foreach ($possible_params[0] as $param) {
                if ($param->type) {
                    $param->type->queueClassLikesForScanning($this->codebase);
                }
            }

            $storage->params = $possible_params[0];
        }

        $storage->required_param_count = 0;

        foreach ($storage->params as $i => $param) {
            if (!$param->is_optional && !$param->is_variadic) {
                $storage->required_param_count = $i + 1;
            }
        }
    }
1102049
protected function getMethodPartAndVerb($method)
    {
        preg_match($this->methodRule, $method, $matches);

        return empty($matches) ? false : array_slice($matches, 1);
    }
1346832
private function getProxyMethods(): array
    {
        if (null !== $this->reflectionProxyMethods) {
            return $this->reflectionProxyMethods;
        }

        $proxyMethods = [];
        $methods = $this->getClassMethods();

        foreach ($methods as $method) {
            $docComment = $method->getDocComment();

            if (\strpos($docComment, 'Transactional') !== false) {
                $annotation = $this->annotationReader->getMethodAnnotation(
                    $method,
                    Transactional::class
                );

                if ($annotation) {
                    $proxyMethods[] = $method;
                }
            }
        }

        $this->reflectionProxyMethods = $proxyMethods;

        return $proxyMethods;
    }
823003
static function getMethodAnnotations($method, $class = NULL)
	{
		$method instanceof ReflectionMethod or $method = new ReflectionMethod($class, $method);

		return static::instance()->getMethodAnnotations($method);
	}
1200628
protected function _getMethodParameters(
        MethodInjection $method = null,
        ReflectionMethod $methodReflection = null,
        array $parameters = []
    ) {
        $args = [];
        if ($methodReflection) {
            foreach ($methodReflection->getParameters() as $index => $parameter) {
                if (array_key_exists($parameter->getName(), $parameters)) {
                    $value = $parameters[$parameter->getName()];
                } elseif ($method && $method->hasParameter($index)) {
                    $value = $method->getParameter($index);
                } else {
                    // If the parameter is optional and wasn't specified,
                    // we take its default value
                    if ($parameter->isOptional()) {
                        $args[] = $this->_getParameterDefaultValue(
                            $parameter,
                            $methodReflection
                        );
                        continue;
                    }

                    throw new DefinitionException(sprintf(
                        "The parameter '%s' of %s::%s has no value defined " .
                        "or guessable",
                        $parameter->getName(),
                        $methodReflection->getDeclaringClass()->getName(),
                        $methodReflection->getName()
                    ));
                }

                if ($value instanceof ObjectDefinition\EntryReference) {
                    $args[] = $this->_container->get($value->getName());
                } else {
                    $args[] = $value;
                }
            }
        }
        return $args;
    }
1242236
protected function methodToConfiguration(ReflectionMethod $method): ?array
    {
        // Get a field from annotation, or an empty one
        /** @var Field $field */
        $field = $this->getAnnotationReader()->getMethodAnnotation($method, Field::class) ?? new Field();

        if (!$field->type instanceof Type) {
            $this->convertTypeDeclarationsToInstances($method, $field);
            $this->completeField($field, $method);
        }

        return $field->toArray();
    }
741540
private function reflectionParams(string $method)
    {
        $class = new ReflectionClass($this);

        if (! is_string($method)) {
            return;
        }

        if (! $class->hasMethod($method)) {
            return;
        }

        $parameters = $class->getMethod($method)->getParameters();

        $arguments = [];

        foreach ($parameters as $key => $parameter) {
            $arguments[] = $this->bind($key, $parameter);
        }

        $this->arguments = $arguments;
    }
971741
private function getMethod(\ReflectionMethod $method)
    {
        $methodStmt = $this->factory->method($method->name);
        $params = $method->getParameters();
        foreach ($params as $param) {
            $methodStmt = $this->getMethodStatement($param, $methodStmt);
        }
        $returnType = $method->getReturnType();
        if ($returnType instanceof \ReflectionType) {
            $this->setReturnType($returnType, $methodStmt);
        }
        $methodInsideStatements = $this->getMethodInsideStatement($method);
        $methodStmt->addStmts($methodInsideStatements);

        return $this->addMethodDocComment($methodStmt, $method);
    }