PHP Class Pantheon\Terminus\Models\TerminusModel

Inheritance: implements Pantheon\Terminus\Request\RequestAwareInterface, use trait Pantheon\Terminus\Request\RequestAwareTrait
Show file Open project: pantheon-systems/terminus Class Usage Examples

Public Properties

Property Type Description
$id string

Protected Properties

Property Type Description
$args Arguments for fetching this model's information
$attributes object
$url The URL at which to fetch this model's information

Public Methods

Method Description
__construct ( object $attributes = null, array $options = [] ) Object constructor
fetch ( array $args = [] ) : TerminusModel Fetches this object from Pantheon
get ( string $attribute ) : mixed Retrieves attribute of given name
getUrl ( ) : string Get the URL for this model
has ( string $attribute ) : boolean Checks whether the model has an attribute
set ( string $attribute, mixed $value ) Sets an attribute

Protected Methods

Method Description
parseAttributes ( object $data ) : object Modify response data between fetch and assignment

Method Details

__construct() public method

Object constructor
public __construct ( object $attributes = null, array $options = [] )
$attributes object Attributes of this model
$options array Options with which to configure this model

fetch() public method

Fetches this object from Pantheon
public fetch ( array $args = [] ) : TerminusModel
$args array Params to pass to request
return TerminusModel $this

get() public method

Retrieves attribute of given name
public get ( string $attribute ) : mixed
$attribute string Name of the key of the desired attribute
return mixed Value of the attribute, or null if not set.

getUrl() public method

Get the URL for this model
public getUrl ( ) : string
return string

has() public method

Checks whether the model has an attribute
public has ( string $attribute ) : boolean
$attribute string Name of the attribute key
return boolean True if attribute exists, false otherwise

parseAttributes() protected method

Modify response data between fetch and assignment
protected parseAttributes ( object $data ) : object
$data object attributes received from API response
return object $data

set() public method

Sets an attribute
public set ( string $attribute, mixed $value )
$attribute string Name of the attribute key
$value mixed The value to assign to the attribute

Property Details

$args protected property

Arguments for fetching this model's information
protected $args

$attributes protected property

protected object $attributes
return object

$id public property

public string $id
return string

$url protected property

The URL at which to fetch this model's information
protected $url