예제 #1
0
 /**
  * @param $method
  * @param array $inputs
  * @return Response
  * @throws CookieExpiredException
  * @throws ProxyMissingParamException
  * @throws \Exception
  */
 public function makeRequest($method, array $inputs)
 {
     $this->checkMandatoriesInputParams($inputs);
     $this->uri = trim(urldecode($inputs[$this->uriParam]));
     //Retrieve the call mode from input parameters
     $this->callMode = $this->getRequestMode($inputs);
     //Remove parameters from inputs
     $inputs = ProxyAux::removeQueryValue($inputs, $this->uriParam);
     $inputs = ProxyAux::removeQueryValue($inputs, $this->skipParam);
     //Read the cookie if exists
     $parsedCookie = null;
     if ($this->callMode !== ProxyAux::MODE_SKIP) {
         try {
             $parsedCookie = $this->cookieManager->tryParseCookie($this->callMode);
         } catch (CookieExpiredException $ex) {
             if (isset($this->redirectUri) && !empty($this->redirectUri)) {
                 return \Redirect::to($this->redirectUri);
             }
             throw $ex;
         }
     }
     //Create the new request
     $requestManager = new RequestManager($this->uri, $method, $this->clientSecrets, $this->callMode, $this->cookieManager);
     if ($this->useHeader) {
         $requestManager->enableHeader();
     }
     $mixResponse = $requestManager->executeRequest($inputs, $parsedCookie);
     return $this->setApiResponse($mixResponse->getResponse(), $mixResponse->getCookie());
 }
예제 #2
0
 /**
  * @param $inputs
  * @return array
  */
 private function removeTokenExtraParams($inputs)
 {
     $inputs = ProxyAux::removeQueryValue($inputs, ProxyAux::ACCESS_TOKEN);
     return $inputs;
 }