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

Crew\Unsplash\User

Properties

$photos

private mixed $photos
  • Visibility: private

$parameters

private array $parameters

All parameters that an endpoint can have

  • Visibility: private

$acceptedHttpMethod

private array $acceptedHttpMethod = array('get', 'post', 'put')

List of accepted http actions that the application can execute.

  • Visibility: private
  • This property is static.

Methods

find

\Crew\Unsplash\User Crew\Unsplash\User::find(string $username)

Retrieve the User object from the username specified.

  • Visibility: public
  • This method is static.

Arguments

  • $username string - <p>Username of the user to find</p>

photos

\Crew\Unsplash\ArrayObject Crew\Unsplash\User::photos(integer $page, integer $per_page)

Retrieve all the photos for a specific user on a specific page.

The function retrieve an ArrayObject that contain Photo object.

  • Visibility: public

Arguments

  • $page integer - <p>Page from which the photos need to be retrieve</p>
  • $per_page integer - <p>Number of element in a page</p>

current

\Crew\Unsplash\User Crew\Unsplash\User::current()

Retrieve the User object of the connected user.

  • Visibility: public
  • This method is static.

update

void Crew\Unsplash\Endpoint::update(array $parameters)

Merge the old parameters with the new one.

Arguments

  • $parameters array

__construct

mixed Crew\Unsplash\Endpoint::__construct($parameters)

Construct a new endpoint object and set the parameters from an array.

Arguments

  • $parameters mixed

__get

mixed Crew\Unsplash\Endpoint::__get(string $key)

Magic method to retrieve a specific parameter in the parameters array.

Arguments

  • $key string

__callStatic

string Crew\Unsplash\Endpoint::__callStatic(string $method, array $arguments)

Validate if the http method is accepted and send a http request to it.

Retrieve error from the request and throw a new error

Arguments

  • $method string - <p>Http action to trigger</p>
  • $arguments array - <p>Array containing all the parameters pass to the magic method</p>

getArray

mixed Crew\Unsplash\Endpoint::getArray($responseBody, $object)

Arguments

  • $responseBody mixed
  • $object mixed

isGoodRequest

boolean Crew\Unsplash\Endpoint::isGoodRequest(\Crew\Unsplash\GuzzleHttp\Psr7\Response $response)

Retrieve the response status code and determine if the request was a success or not

Arguments

  • $response Crew\Unsplash\GuzzleHttp\Psr7\Response - <p>of the http request</p>

getErrorMessage

string Crew\Unsplash\Endpoint::getErrorMessage(\Crew\Unsplash\GuzzleHttp\Psr7\Response $response)

Retrieve the error message in the body.

Arguments

  • $response Crew\Unsplash\GuzzleHttp\Psr7\Response - <p>of the http request</p>