Skip to content
Andrea Zoellner edited this page Jul 30, 2015 · 2 revisions

Crew\Unsplash\HttpClient

  • Class name: HttpClient
  • Namespace: Crew\Unsplash

Constants

TEST_MODE

const TEST_MODE = 'test'

STAGING_MODE

const STAGING_MODE = 'staging'

Properties

$httpClient

private mixed $httpClient
  • Visibility: private

$host

private mixed $host = 'api.unsplash.com'
  • Visibility: private

$scheme

private mixed $scheme = 'https'
  • Visibility: private

$connection

public \Crew\Unsplash\Crew\Unsplash\Connection $connection

Crew\Unsplash\Connection object link to the HttpClient

Needs to be set to the class before running anything else.

  • Visibility: public
  • This property is static.

Methods

__construct

mixed Crew\Unsplash\HttpClient::__construct()

Generate a new http client variable. Retrieve the authorization token generated by the $connection object.

  • Visibility: public

send

\Crew\Unsplash\GuzzleHttp\Psr7\Response Crew\Unsplash\HttpClient::send(string $method, $arguments)

Send an http request through the http client.

Generate a new request method with the http method and the URI is passed.

  • Visibility: public

Arguments

  • $method string - <p>http method to be trigger</p>
  • $arguments mixed

getHost

string Crew\Unsplash\HttpClient::getHost()

Retrieve the host to which the client will send the request.

  • Visibility: public

getScheme

string Crew\Unsplash\HttpClient::getScheme()

Retrieve the scheme to which the client will send the request.

  • Visibility: public

setHandler

\Crew\Unsplash\GuzzleHttp\HandlerStack Crew\Unsplash\HttpClient::setHandler(string $authorization)

Generate a new handler that will manage the http request.

Some middleware is also set to manage the authorization header and the requested URI.

  • Visibility: private

Arguments

  • $authorization string - <p>Authorization code to pass in the header</p>

setHostAndScheme

mixed Crew\Unsplash\HttpClient::setHostAndScheme()

Set the host and the scheme information if it's run in test mode or staging mode.

  • Visibility: private

Api Index

Clone this wiki locally