PHP Trait SimpleSoftwareIO\SMS\MakesRequests

Show file Open project: simplesoftwareio/simple-sms

Protected Properties

Property Type Description
$auth array Holds the username and password for requests.
$body array Holds the arguments for the body.
$callBuilt boolean Has the call been built yet

Public Methods

Method Description
buildBody ( array | string $values, null $key = null ) Builds the body part of the request and adds it to the body array.
setPassword ( string $password ) Sets the password for auth.
setUser ( string $username ) Sets the username for auth.

Protected Methods

Method Description
buildCall ( $url ) Builds the API call address.
buildUrl ( array $segments = [] ) : string Builds a URL.
getAuth ( ) : array | null Returns the auth array for requests. If not set, will return null.
getBody ( ) : array Returns the body array.
getRequest ( ) : mixed Creates and sends a GET request to the requested URL.
postRequest ( ) : mixed Creates and sends a POST request to the requested URL.

Method Details

buildBody() public method

Builds the body part of the request and adds it to the body array.
public buildBody ( array | string $values, null $key = null )
$values array | string
$key null

buildCall() protected method

Builds the API call address.
protected buildCall ( $url )
$url

buildUrl() protected method

Builds a URL.
protected buildUrl ( array $segments = [] ) : string
$segments array
return string

getAuth() protected method

Returns the auth array for requests. If not set, will return null.
protected getAuth ( ) : array | null
return array | null

getBody() protected method

Returns the body array.
protected getBody ( ) : array
return array

getRequest() protected method

Creates and sends a GET request to the requested URL.
protected getRequest ( ) : mixed
return mixed

postRequest() protected method

Creates and sends a POST request to the requested URL.
protected postRequest ( ) : mixed
return mixed

setPassword() public method

Sets the password for auth.
public setPassword ( string $password )
$password string

setUser() public method

Sets the username for auth.
public setUser ( string $username )
$username string

Property Details

$auth protected property

Holds the username and password for requests.
protected array $auth
return array

$body protected property

Holds the arguments for the body.
protected array $body
return array

$callBuilt protected property

Has the call been built yet
protected bool $callBuilt
return boolean