Returns first route annotation for method.

@param \ReflectionMethod $reflectionMethod

@return RouteAnnotation[]
184503
private function readRouteAnnotation(\ReflectionMethod $reflectionMethod)
    {
        $annotations = [];

        if ($newAnnotations = $this->readMethodAnnotations($reflectionMethod, 'Route')) {
            $annotations = array_merge($annotations, $newAnnotations);
        }

        return $annotations;
    }
914688
public function getSorts(\ReflectionClass $reflectionClass)
    {
        if ($this->isProduction()) {
            $this->grid->getSort()->getFields();
        }

        $properties = $reflectionClass->getProperties(\ReflectionProperty::IS_PRIVATE | \ReflectionProperty::IS_PROTECTED);
        /** @var \ReflectionProperty $property */
        foreach ($properties as $property) {
            $propertyAnnotations = $this->extractorFactory->extract($property, Extractor::PROPERTY_ANNOTATION);
            foreach ($propertyAnnotations as $annotation) {
                if ($annotation instanceof Sort) {
                    $fields[] = $property->getName();
                }
            }
        }

        return !empty($fields) ? $fields : $this->grid->getSort()->getFields();
    }
254795
protected function buildMethodMaps()
    {

        $getterMap = [];
        $setterMap = [];

        $methods = (new ReflectionObject($this))->getMethods(ReflectionMethod::IS_PUBLIC);

        foreach ($methods as $method) {

            if ($this->isGetter($method)) {
                $getterMap[$this->toPropertyName($method->getName())] = $method->getName();
                continue;
            }

            if ($this->isSetter($method)) {
                $setterMap[$this->toPropertyName($method->getName())] = $method->getName();
                continue;
            }


        }

        return [$getterMap, $setterMap];
    }
1124477
public function getMethodAnnotations($className, $methodName, $annotationClassName = null)
    {
        if (!$this->initialized) {
            $this->initialize();
        }
        $className = $this->cleanClassName($className);
        $annotationClassName = $annotationClassName === null ? null : $this->cleanClassName($annotationClassName);

        $annotations = [];
        $methodAnnotations = $this->annotationReader->getMethodAnnotations(new MethodReflection($className, $methodName));
        if ($annotationClassName === null) {
            return $methodAnnotations;
        }

        foreach ($methodAnnotations as $annotation) {
            if ($annotation instanceof $annotationClassName) {
                $annotations[] = $annotation;
            }
        }

        return $annotations;
    }
39785
public static function getMethodAnnotations($className, $methodName, $annotationClassName = null)
    {
        if(!isset(static::$annotations[$className]['Methods'][$methodName]))
        {
            return [];
        }
        if(null === $annotationClassName)
        {
            return static::$annotations[$className]['Methods'][$methodName];
        }
        else
        {
            $result = [];
            foreach(static::$annotations[$className]['Methods'][$methodName] as $annotation)
            {
                if($annotation instanceof $annotationClassName)
                {
                    $result[] = $annotation;
                }
            }
            return $result;
        }
    }
250946
public function getMethods()
    {
        if (!$this->__methods)
        {
            $methods = array();

            $reflection = new \ReflectionClass($this);
            foreach ($reflection->getMethods() as $method) {
                $methods[$method->name] = $method->name;
            }

            $this->__methods = $methods;
        }

        return $this->__methods;
    }
1179311
protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method)
    {
        $routeName = parent::getDefaultRouteName($class, $method);

        return preg_replace(array(
            '/(module_|controller_?)/',
            '/__/'
        ), array(
            '_',
            '_'
        ), $routeName);
    }
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;
    }
679774
protected function resolveNameByMethod(\ReflectionMethod $method): string
    {
        $name = $method->getName();

        if (preg_match('~^(?:get|is)(?<name>[a-z0-9_]+)~i', $name, $matches)) {
            return lcfirst($matches['name']);
        }

        return $name;
    }
400159
protected function buildMethod(ReflectionMethod $method)
    {
        $argString = "";
        $paramString = "";
        foreach ($method->getParameters() as $value) {
            $argString .= "\${$value->getName()}, ";
            $paramString .= $this->getParamString($value);
        }

        $argString = trim($argString, ", ");
        $paramString = trim($paramString, ", ");
        $replaces = array(
            $method->getDocComment(),
            $method->getName(),
            $paramString,
            $argString
        );
        return str_replace(self::$methodTplSearches, $replaces, $this->template->getMethodTemplate());
    }
1315105
public function getByMethod($method = null)
    {
        if (is_null($method)) {
            return $this->getRoutes();
        }

        // Filter routes by the given method
        return ArrayHelper::get($this->routes, $method, []);
    }
1330675
private function getOnValidate(\ReflectionMethod $method)
    {
        /** @var $valid Valid */
        $valid = $this->reader->getMethodAnnotation($method, Valid::class);
        $class = $method->getDeclaringClass();
        $onMethods = $this->findOnMethods($class, $valid);
        if ($onMethods[0] && $onMethods[0] instanceof \ReflectionMethod) {
            return $onMethods;
        }
        throw new ValidateMethodNotFound($method->getShortName());
    }
684480
private function getClassMethods(): array
    {
        if (null !== $this->reflectionMethods) {
            return $this->reflectionMethods;
        }

        $this->reflectionMethods = [];

        $class = $this->reflectionClass;

        do {
            $this->reflectionMethods = \array_merge(
                $this->reflectionMethods,
                $class->getMethods()
            );
        } while ($class = $class->getParentClass());

        return $this->reflectionMethods;
    }
366463
private function ignoreAnnotatedPrameter(\ReflectionMethod $method, array $paramMetas) : array
    {
        $annotations = $this->reader->getMethodAnnotations($method);
        foreach ($annotations as $annotation) {
            if ($annotation instanceof ResourceParam) {
                unset($paramMetas['parameters'][$annotation->param]);
                $paramMetas['required'] = array_values(array_diff($paramMetas['required'], [$annotation->param]));
            }
            if ($annotation instanceof Assisted) {
                $paramMetas = $this->ignorreAssisted($paramMetas, $annotation);
            }
        }

        return $paramMetas;
    }
413373
private function getArguments(\ReflectionMethod $method)
    {
        $arguments = [];

        foreach ($method->getParameters() as $index => $parameter) {
            $argument = $this->getArgument($index, $parameter);

            if (null === $argument && false === $parameter->allowsNull()) {
                throw new Exception(
                    sprintf('Could not inject parameter #%d into "%s::__construct"', $index, $this->item)
                );
            }

            $arguments[] = $argument;
        }

        return $arguments;
    }
583636
private function getMethods(): array
    {
        $tests = [];
        $methods = $this->refl->getMethods(\ReflectionMethod::IS_PUBLIC);
        foreach ($methods as $method) {
            $hasTestName = preg_match(self::$testName, $method->getName());
            $docComment = $method->getDocComment();
            $hasTestAnnotation = false !== $docComment && preg_match(self::$testAnnotation, $docComment);
            $isTestMethod = $hasTestName || $hasTestAnnotation;
            if ($isTestMethod) {
                $tests[] = new ParsedFunction((string) $method->getDocComment(), 'public', $method->getName());
            }
        }

        return $tests;
    }
1336354
public function routes($method = null)
    {
        if ($method && isset($this->methods[$method])) {
            return $this->routes[$method];
        }
        return $this->routes;
    }