src/Request/BazaarvoiceRequest.php
private function buildUrl($endpoint, array $additional_parameters = []) {
    // Build base domain URI.
    $base = ($this->use_stage ? 'stg.' : '') . $this->domain;
    // Build initial array of parameters.
    $parameters = [
      'passKey=' . $this->apiKey,
      'ApiVersion=' . self::$api_version,
    ];

    // Adding additional parameters?
    if (!empty($additional_parameters)) {
      // Loop through each parameter to build out correctly.
      foreach ($additional_parameters as $param_name => $param_value) {
        // If value is an array, then passing multiple sub parameter values.
        if (is_array($param_value)) {
          // Build each sub parameter.
          foreach ($param_value as $sub_param_name => $sub_param_value) {
            // Add to parameters array.
            $sub_param_value = is_array($sub_param_value) ? implode(",", $sub_param_value) : $sub_param_value;
            $parameters[] = $param_name . '=' . $sub_param_name . ':' . $sub_param_value;
          }
        }
        // Else it is just a single value parameter.
        else {
          // Add to parameters array.
          $parameters[] = $param_name . '=' . $param_value;
        }
      }
    }

    // Implode all of the parameters.
    $parameters = implode('&', $parameters);

    // return the built url.
    return $base . '/' . $endpoint . '.json?' . $parameters;
  }
private function buildUrl($endpoint, array $additional_parameters = []) {
    // Build base domain URI.
    $base = ($this->use_stage ? 'stg.' : '') . $this->domain;
    // Build initial array of parameters.
    $parameters = [
      'passKey=' . $this->apiKey,
      'ApiVersion=' . self::$api_version,
    ];

    // Adding additional parameters?
    if (!empty($additional_parameters)) {
      // Loop through each parameter to build out correctly.
      foreach ($additional_parameters as $param_name => $param_value) {
        // If value is an array, then passing multiple sub parameter values.
        if (is_array($param_value)) {
          // Build each sub parameter.
          foreach ($param_value as $sub_param_name => $sub_param_value) {
            // Add to parameters array.
            $sub_param_value = is_array($sub_param_value) ? implode(",", $sub_param_value) : $sub_param_value;
            $parameters[] = $param_name . '=' . $sub_param_name . ':' . $sub_param_value;
          }
        }
        // Else it is just a single value parameter.
        else {
          // Add to parameters array.
          $parameters[] = $param_name . '=' . $param_value;
        }
      }
    }

    // Implode all of the parameters.
    $parameters = implode('&', $parameters);

    // return the built url.
    return $base . '/' . $endpoint . '.json?' . $parameters;
  }
private function buildUrl ( $ endpoint , array $ additional_parameters = [ ] ) { // Build base domain URI. $ base = ( $ this -> use_stage ? 'stg.' : '' ) . $ this -> domain ; // Build initial array of parameters. $ parameters = [ 'passKey=' . $ this -> apiKey , 'ApiVersion=' . self :: $ api_version , ] ; // Adding additional parameters? if ( ! empty ( $ additional_parameters ) ) { // Loop through each parameter to build out correctly. foreach ( $ additional_parameters as $ param_name => $ param_value ) { // If value is an array, then passing multiple sub parameter values. if ( is_array ( $ param_value ) ) { // Build each sub parameter. foreach ( $ param_value as $ sub_param_name => $ sub_param_value ) { // Add to parameters array. $ sub_param_value = is_array ( $ sub_param_value ) ? implode ( "," , $ sub_param_value ) : $ sub_param_value ; $ parameters [ ] = $ param_name . '=' . $ sub_param_name . ':' . $ sub_param_value ; } } // Else it is just a single value parameter. else { // Add to parameters array. $ parameters [ ] = $ param_name . '=' . $ param_value ; } } } // Implode all of the parameters. $ parameters = implode ( '&' , $ parameters ) ; // return the built url. return $ base . '/' . $ endpoint . '.json?' . $ parameters ; }
Create Bazaarvoice URL with added parameters.

@param string $endpoint
API endpoint to call.

@param array $additional_parameters
Key/value of url parameters to add to URL.

@return string
Formatted API request URL.
Create Bazaarvoice URL with added parameters .