@param Request $request
@param string  $name
@param string  $redirectUrl     Optional
@param array   $extraParameters Optional

@return string
3955
public function getAuthorizationUrl(Request $request, $name, $redirectUrl = null, array $extraParameters = [])
    {
        $resourceOwner = $this->getResourceOwner($name);
        if (null === $redirectUrl) {
            if (!$this->connect || !$this->authorizationChecker->isGranted($this->grantRule)) {
                $redirectUrl = $this->httpUtils->generateUri($request, $this->getResourceOwnerCheckPath($name));
            } else {
                $redirectUrl = $this->getServiceAuthUrl($request, $resourceOwner);
            }
        }

        return $resourceOwner->getAuthorizationUrl($redirectUrl, $extraParameters);
    }
996603
public function param( $param_name, $callback )
	{
		if( is_callable($callback) )
		{
			$this->_params[$param_name] = $callback( new request() );
		}
		else
		{
			$this->_params[$param_name] = $callback;
		}
	}
367453
public static function url($name, array $params = null, $protocol = null)
    {
        $route = Route::get($name);
        return $route->isExternal()
            ? $route->uri($params)
            : Url::site($route->uri($params), $protocol);
    }
232380
public function expireCookie($name, $extra = '')
    {
        $extra = implode('; ', array_filter([ $extra, 'Expires=' . date('r', 0) ]));
        return $this->withCookie($name, 'deleted', $extra);
    }
406462
protected function sendRequest($method, $uri, array $extraParameters = array(), array $clientOptions = array())
    {
        $request = $this->createGuzzleRequest($method, $uri, $extraParameters);

        $client = $this->getGuzzleClientIntance();

        return $client->send($request, $clientOptions);
    }
148194
public function create(string $name, string $request)
    {
        return $this->curl->post($this->base_url.'/create?'.http_build_query([
                    'name' => $name,
                ]
            ), $request
        );
    }
853509
public function getUrl($name, $params = array())
	{
		if('http' === substr($name, 0, 4))
		{
			$domain = $name;
		}
		else
		{
			$domain = static::API_DOMAIN . $name;
		}
		return $domain . (empty($params) ? '' : ('?' . $this->http_build_query($params)));
	}
1318555
public function createRequestUri($name, array $query = array())
    {
        if (empty($this->routeMapping[$name])) {
            throw new \InvalidArgumentException(sprintf('Unknow request preset under name "%s", only [%s] defined.',
                $name,
                implode('","', array_keys($this->routeMapping))
            ));
        }

        // build request
        return $this->urlGenerator->generate(
            $this->routeMapping[$name],
            $query,
            UrlGeneratorInterface::ABSOLUTE_URL
        );
    }
1136132
public function findByName($name, $extraDatas = array(), $executeQuery = true)
    {
        $name  = strtoupper($name);
        /** @var \Doctrine\ORM\QueryBuilder $queryBuilder */
        $queryBuilder = $this->createQueryBuilder('resourceNode');
        $queryBuilder->where($queryBuilder->expr()->like('UPPER(resourceNode.name)', ':name'));

        if (0 < count($extraDatas)) {
            foreach ($extraDatas as $key => $extraData) {
                $queryBuilder
                    ->andWhere(sprintf('resourceNode.%s = :%s', $key, $key))
                    ->setParameter(sprintf(':%s', $key), $extraData);
            }
        }

        $queryBuilder
            ->orderBy('resourceNode.name', 'ASC')
            ->setParameter(':name', "%{$name}%");

        return $executeQuery ? $queryBuilder->getQuery()->getResult(): $queryBuilder;
    }
336881
public function getResetPath($route, $extraParams = array())
    {
        $params = array(
            $this->getActionParameterName() => $this->getResetActionParameterName(),
            $this->getDatagridParameterName() => $this->getName(),
        );
        return $this->container->get('router')->generate($route, array_merge($params, $extraParams));
    }
131816
public function block( $user, array $extraParams = [] ) {
		if ( !$user instanceof User && !is_string( $user ) ) {
			throw new InvalidArgumentException( '$user must be either a string or User object' );
		}

		if ( $user instanceof User ) {
			$user = $user->getName();
		}

		$params = [
			'user' => $user,
			'token' => $this->api->getToken( 'block' ),
		];

		$params = array_merge( $extraParams, $params );

		$this->api->postRequest( new SimpleRequest( 'block', $params ) );
		return true;
	}
867830
public function getRedirectFor(Request $request)
    {
        $redirects = $this->redirector->getRedirectsFor($request);

        collect($redirects)->each(function ($redirects, $missingUrl) {
            $this->router->get($missingUrl, function () use ($redirects, $missingUrl) {
                $redirectUrl = $this->determineRedirectUrl($redirects);
                $statusCode = $this->determineRedirectStatusCode($redirects);

                event(new RouteWasHit($redirectUrl, $missingUrl, $statusCode));

                return redirect()->to(
                    $redirectUrl,
                    $statusCode
                );
            });
        });

        try {
            return $this->router->dispatch($request);
        } catch (Exception $e) {
            event(new RedirectNotFound($request));

            return;
        }
    }
52659
public function redirectIfNotUrl($url, array $allowParams = array())
    {
        if ($url != $this->getRequest()->getRequestUri()) {
            $redirect = true;
            $newArgs = array();
            try {
                $tmp = parse_url($this->getRequest()->getRequestUri());
                if (isset($tmp['path']) && $tmp['path'] == $url) {
                    $redirect = false;
                }
                if (isset($tmp['query'])) {
                    parse_str($tmp['query'], $args);
                    $alloweds = array_merge($allowParams, $this->getParameter('nyroDev_utility.redirectIfNotUrl_params', array()));
                    foreach ($alloweds as $k) {
                        if (isset($args[$k])) {
                            $newArgs[$k] = $args[$k];
                        }
                    }
                    $redirect = count($newArgs) != count($args);
                }
            } catch (\Exception $e) {
                $redirect = false;
            }
            if ($redirect) {
                return new RedirectResponse($url.(count($newArgs) ? '?'.http_build_query($newArgs) : ''), 301);
            }
        }

        return false;
    }
335211
public function assertRedirectedToAction($name, $parameters = [], $with = [])
    {
        return $this->assertRedirectedTo($this->app['url']->action($name, $parameters), $with);
    }
281652
function load( $uri, $extraParameters = false, $returnResourceData = false )
    {
        $resourceData = $this->loadURIRoot( $uri, true, $extraParameters );
        if ( !$resourceData or
             $resourceData['root-node'] === null )
        {
            $retValue = null;
            return $retValue;
        }
        else
            return $resourceData['root-node'];
    }
736629
public function returnSuccess($message = '操作成功', $url = '', $extra = [])
    {
        if (! empty($this->redirectRoute)) {
            $url = Url::toRoute([
                $this->redirectRoute,
                'msg' => $message,
                'url' => $url,
                $extra
            ]);
        }
        $this->redirect($url);
    }
836523
public function process(HTTPRequest $request, callable $delegate)
    {
        // Handle any redirects
        $redirect = $this->getRedirect($request);
        if ($redirect) {
            return $redirect;
        }

        /** @var HTTPResponse $response */
        $response = $delegate($request);
        if ($this->hasBasicAuthPrompt($response)
            && $request->getScheme() !== 'https'
            && $this->getForceBasicAuthToSSL()
        ) {
            return $this->redirectToScheme($request, 'https');
        }

        return $response;
    }