Get the HTTP GET vars which are requested by the method using method parameters (a kind of injecting the get
vars into the action method name).
@param BaseController $controller
@param string $methodName
@return array
@throws \ReflectionException
549898
private function getHttpGetVars(BaseController $controller, string $methodName): array
    {
        $requestParams = [];
        $reflectionMethod = new \ReflectionMethod($controller, $methodName);
        $reflectionParameters = $reflectionMethod->getParameters();
        foreach ($reflectionParameters as $reflectionParameter) {
            $name = $reflectionParameter->getName();
            $queryParams = $this->request->getQueryParams();
            if (isset($queryParams[$name])) {
                $requestParams[$name] = $queryParams[$name];
            }
        }

        return $requestParams;
    }
1158008
private function invalidArrayParameterException(\ReflectionFunctionAbstract $controller, RequestParam $annotation) : HttpBadRequestException
    {
        return new HttpBadRequestException(sprintf(
            '%s() expects an array for %s parameter "%s" (bound to $%s), string given.',
            $this->reflectionTools->getFunctionName($controller),
            $annotation->getParameterType(),
            $annotation->getName(),
            $annotation->getBindTo()
        ));
    }
644295
public function controllerWithoutPrefix($controller)
    {
        $controller = new ReflectionClass($controller);
        $methods = $controller->getMethods(ReflectionMethod::IS_PUBLIC);
        return $this->collectControllerRoutes($controller, $methods, "/");
    }
549216
public Controller getController(JsonPath jsonPath, String method) {
		for (Controller controller : controllers) {
			if (controller.isAcceptable(jsonPath, method)) {
				LOGGER.debug("using controller {}", controller);
				return controller;
			}
		}
		throw new BadRequestException(jsonPath + " with method " + method);
	}
378099
protected function getControllerActionMetadata($controller)
    {
        $controllerClass = get_class($controller[0]);

        $metadata = $this->metadataFactory->getMetadataForClass($controllerClass);

        $controllerMetadata = $metadata->getOutsideClassMetadata();

        $action_metadatas = null;
        if (array_key_exists($controller[1], $controllerMetadata->methodMetadata)) {
            $action_metadatas = $controllerMetadata->methodMetadata[$controller[1]];
        }

        return $action_metadatas;
    }
889562
protected function parseParameters(array $parameters, $controller) {
        if(!isset($parameters['uses']) || $parameters['uses'] === null) {
            if($controller === null) {
                throw new InvalidArgumentException('No `uses` key provided for Action');
            } else {
                $parameters['uses'] = $controller . '@' . $parameters['name'];
            }
        }

        return $parameters;
    }
1196512
public function getController($controllerName = null, $actionName = 'index')
    {
        if (null !== $controllerName or 'index' !== $actionName) {
            $className = empty($controllerName) ? $this->module : $controllerName;

            return [
                '_controller' => $this->module.'ModuleBundle:'.$className.':'.$actionName,
            ];
        }

        if (empty($this->controller)) {
            $className = (null === $controllerName) ? $this->module : $controllerName;
            $this->controller['_controller'] = $this->module.'ModuleBundle:'.$className.':'.$actionName;
        }

        return $this->controller;
    }
637400
protected function vars(String & $controller)
    {
        if( ! empty($this->settings['vars']) )
        {
            $var = '';
            foreach( $this->settings['vars'] as $isKey => $var )
            {
                if( ! is_numeric($isKey) )
                {
                    $value = $var;
                    $var   = $isKey;
                }

                $vars = $this->vartype($var);
                $controller .= HT.$vars->priority.' $'.$vars->var.( ! empty($value) ? " = ".$value : '' ).";".EOL;
            }

            $controller .= EOL;
        }
    }
864672
private function getControllerParams(Request $request, $controllerString)
    {
        $query = $request->query->all();
        $methodParameters = $this->getControllerParameters($controllerString);

        $parameters = array();
        foreach ($methodParameters as $methodParameter) {
            $parameterName = $methodParameter->getName();
            if ('request' === $parameterName) continue;

            if (isset($query[$parameterName])) {
                $parameters[$parameterName] = $query[$parameterName];
                unset($query[$parameterName]);
            }
        }

        return array($parameters, $query);
    }
1372849
public function getReflectionMethod(string $controller)
    {
        $callable = $this->getClassAndMethod($controller);
        if (null === $callable) {
            return null;
        }

        list($class, $method) = $callable;

        try {
            return new \ReflectionMethod($class, $method);
        } catch (\ReflectionException $e) {
            // In case we can't reflect the controller, we just
            // ignore the route
        }
    }
1088456
public function setUrl($pageName, $controller)
    {
        $params = [
            'id'   => $this->id,
            'slug' => $this->slug
        ];

        return $this->url = $controller->pageUrl($pageName, $params, false);
    }
1267718
protected function parseController($controller)
    {
        if (\is_string($controller) && false !== strpos($controller, '::')) {
            $controller = explode('::', $controller);
        }

        if (\is_array($controller)) {
            try {
                $r = new \ReflectionMethod($controller[0], $controller[1]);

                return [
                    'class' => \is_object($controller[0]) ? \get_class($controller[0]) : $controller[0],
                    'method' => $controller[1],
                    'file' => $r->getFileName(),
                    'line' => $r->getStartLine(),
                ];
            } catch (\ReflectionException $e) {
                if (\is_callable($controller)) {
                    // using __call or  __callStatic
                    return [
                        'class' => \is_object($controller[0]) ? \get_class($controller[0]) : $controller[0],
                        'method' => $controller[1],
                        'file' => 'n/a',
                        'line' => 'n/a',
                    ];
                }
            }
        }

        if ($controller instanceof \Closure) {
            $r = new \ReflectionFunction($controller);

            $controller = [
                'class' => $r->getName(),
                'method' => null,
                'file' => $r->getFileName(),
                'line' => $r->getStartLine(),
            ];

            if (false !== strpos($r->name, '{closure}')) {
                return $controller;
            }
            $controller['method'] = $r->name;

            if ($class = $r->getClosureScopeClass()) {
                $controller['class'] = $class->name;
            } else {
                return $r->name;
            }

            return $controller;
        }

        if (\is_object($controller)) {
            $r = new \ReflectionClass($controller);

            return [
                'class' => $r->getName(),
                'method' => null,
                'file' => $r->getFileName(),
                'line' => $r->getStartLine(),
            ];
        }

        return \is_string($controller) ? $controller : 'n/a';
    }
716490
protected function parseController($controller)
    {
        if (!is_array($controller) || !is_object($controller[0]) || !isset($controller[1])) {
            return null;
        }

        if (!preg_match('#Controller\\\(.+)Controller$#', get_class($controller[0]), $matches)) {
            return null;
        }

        return ['name' => $matches[1], 'action' => $controller[1]];
    }
477096
protected static function _controllerMethods($className)
    {
        if (!class_exists($className)) {
            return [];
        }

        $methods = (array)get_this_class_methods($className);
        $actions = [];
        foreach ($methods as $methodName) {
            try {
                $method = new ReflectionMethod($className, $methodName);
                if ($method->isPublic()) {
                    $actions[] = $methodName;
                }
            } catch (\ReflectionException $e) {
                // error
            }
        }

        return $actions;
    }
738893
private function getControllerMethods ($controller)
	{
		
		// Check controller exists
		
		if (!\Sonic\Sonic::_classExists (__NAMESPACE__ . '\\' . $controller))
		{
			return array ();
		}
		
		// Set actions
		
		$actions	= array ();
		
		/**
		 * Reflect controller
		 */
		
		$reflection	= new \ReflectionClass (__NAMESPACE__ . '\\' . $controller);
		$className	= $reflection->getName ();
		
		// Get class methods
		
		foreach ($reflection->getMethods () as $method)
		{
			
			// Dont use methods from parent classes
			
			if ($method->getDeclaringClass ()->getName () != $className)
			{
				continue;
			}
			
			// Skip unless the method is public
			
			if (!$method->isPublic ())
			{
				continue;
			}
			
			// Skip methods starting with __
			
			if (substr ($method->getName (), 0, 2) == '__')
			{
				continue;
			}
			
			// Get class name and comment
			
			$name		= $method->getName ();
			$comment	= new \Sonic\Model\Tools\Comment ($method->getDocComment ());
			
			// Skip if @ignore is set in the method comment
			
			if ($comment->hasTag ('ignore'))
			{
				continue;
			}
			
			// Add action
			
			$actions[$name] = array (
				'description'	=> $comment->getShortDescription (),
				'notes'			=> $comment->getLongDescription (),
				'url'			=> URL_ROOT . str_replace ('\\', '/', strtolower ($controller)) . '/' . $name,
				'auth'			=> FALSE
			);
			
			// Deal with authenticated method
			
			if ($comment->hasTag ('authenticated'))
			{
				$actions[$name]['auth']	= TRUE;
			}
			
			// Add method parameters
			
			$params	= $comment->getTags ('param');
			
			if ($params)
			{
				
				foreach ($params as $param)
				{
					
					if (!preg_match ('/^(\w+)\s+\$([\w\d]+)\s*(.*?)$/', $param, $arr))
					{
						continue;
					}
					
					$actions[$name]['param'][]	= array (
						'type'			=> $arr[1],
						'name'			=> $arr[2],
						'description'	=> $arr[3]
					);
					
				}
				
			}
			
		}
		
		// Return actions
		
		return $actions;
		
	}
178779
protected function getControllerMiddlewareFromInstance($controller, $method)
    {
        $middleware = $this->router->getMiddleware();

        $results = [];

        foreach ($controller->getMiddleware() as $name => $options) {
            if (!$this->methodExcludedByOptions($method, $options)) {
                $results[$name] = array_get($middleware, $name, $name);
            }
        }

        return $results;
    }
1147781
protected function getActionRoutes($controller, &$result)
    {
        $token = "Get actions of controller '" . $controller->uniqueId . "'";
        Yii::beginProfile($token, __METHOD__);
        try {
            $prefix = '/' . $controller->uniqueId . '/';
            foreach ($controller->actions() as $id => $value) {
                $result[$prefix . $id] = $prefix . $id;
            }
            $class = new \ReflectionClass($controller);
            foreach ($class->getMethods() as $method) {
                $name = $method->getName();
                if ($method->isPublic() && !$method->isStatic() && strpos($name, 'action') === 0 && $name !== 'actions') {
                    $name = strtolower(preg_replace('/(?<![A-Z])[A-Z]/', ' \0', substr($name, 6)));
                    $id = $prefix . ltrim(str_replace(' ', '-', $name), '-');
                    $result[$id] = $id;
                }
            }
        } catch (\Exception $exc) {
            Yii::error($exc->getMessage(), __METHOD__);
        }
        Yii::endProfile($token, __METHOD__);
    }