/**
  * @param HttpParameterBag $httpParameterBag
  * @return string
  */
 public function getRequestUrl(HttpParameterBag $httpParameterBag)
 {
     $parameters = '';
     $parametersGet = $httpParameterBag->getParameterGet();
     if (!empty($parametersGet)) {
         $parameters = (string) '?' . http_build_query($httpParameterBag->getParameterGet());
     }
     return (string) $httpParameterBag->getBaseUrl() . '' . $this->getRequestUri($httpParameterBag->getResource()) . '' . $parameters;
 }
Example #2
0
 /**
  * @param $method
  * @param $resourceMethod
  * @param array $requestUriParameters
  * @param array $parametersGet
  * @param array $parametersPost
  * @return HttpParameterBag
  * @throws \Exception
  */
 public function createParameterBag($method, $resourceMethod, $requestUriParameters = array(), $parametersGet = array(), $parametersPost = array())
 {
     $parameterBag = new HttpParameterBag();
     $parameterBag->setMethod($method);
     $parameterBag->setParameterGet($parametersGet);
     $parameterBag->setUri($this->getRequestUri($resourceMethod, $requestUriParameters));
     if ($method == HttpAdapterInterface::HTTP_METHOD_POST || $method == HttpAdapterInterface::HTTP_METHOD_PUT) {
         $parameterBag->setParameterPostFormat('application/json');
         $parameterBag->setParameterPost($parametersPost);
     }
     $parameterBag->setHeaders($this->getAuthAdapter()->getDefaultHeaders($parameterBag));
     return $parameterBag;
 }