You are here

class GeocoderHttpAdapter in Geocoder 8.2

Extends AbstractHttpAdapter to use Guzzle.

Hierarchy

Expanded class hierarchy of GeocoderHttpAdapter

1 string reference to 'GeocoderHttpAdapter'
geocoder.services.yml in ./geocoder.services.yml
geocoder.services.yml
1 service uses GeocoderHttpAdapter
geocoder.http_adapter in ./geocoder.services.yml
Drupal\geocoder\GeocoderHttpAdapter

File

src/GeocoderHttpAdapter.php, line 12

Namespace

Drupal\geocoder
View source
class GeocoderHttpAdapter extends AbstractHttpAdapter {

  /**
   * The HTTP client.
   *
   * @var \GuzzleHttp\Client
   */
  protected $httpClient;

  /**
   * {@inheritdoc}
   */
  public function getName() {
    return 'geocoder_http_adapter';
  }

  /**
   * Creates an HTTP adapter.
   *
   * @param \GuzzleHttp\ClientInterface $httpClient
   *   A Guzzle client object.
   */
  public function __construct(ClientInterface $httpClient) {
    parent::__construct();
    $this->httpClient = $httpClient;
  }

  /**
   * {@inheritdoc}
   */
  protected function sendInternalRequest(InternalRequestInterface $internalRequest) {
    return $this->httpClient
      ->request($internalRequest
      ->getMethod(), (string) $internalRequest
      ->getUri(), [
      'headers' => $this
        ->prepareHeaders($internalRequest, FALSE, FALSE),
    ]);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
GeocoderHttpAdapter::$httpClient protected property The HTTP client.
GeocoderHttpAdapter::getName public function
GeocoderHttpAdapter::sendInternalRequest protected function
GeocoderHttpAdapter::__construct public function Creates an HTTP adapter.