Model

Implements \NextEvent\PHPSDK\Util\Log\LogContextInterface, \Serializable

Base class for model classes

Data structures retrieved from the NextEvent API are wrapped into dependants of this class in order to provide a well-defined struct for accessing these informations.

With the Serializable interface implemented, all models can easily be serialized and stored in session data.

package

NextEvent\PHPSDK\Model

Methods

Supports getX or hasX Methods for properties which are yet unknown.

__call(string $name, array $args) : mixed

If the source of your model contains, e.g. a property named 'my_property', you can call getMyProperty() to retrieve it's value.

Arguments

$name

string

$args

array

Response

mixed

Model constructor

__construct(array $source) 

Parse source data.

Throws
\NextEvent\PHPSDK\Exception\InvalidModelDataException

Arguments

$source

array

The source data as received from the API

Get the value for the given variable.

get(string $var) : mixed

Should be used, if you expect the model to have custom properties which are not known/covered by the known getters

Arguments

$var

string

Response

mixed

Check model state if it is valid

isValid() : boolean
abstract

Response

boolean

String representation of object

serialize() : string

Implements Serializable interface

Response

string

Convert model to an Array

toArray() : array

Response

array

Convert the model for logging

toLogContext() : array

Implements the LogContextInterface interface

Response

array

Represent the model as string

toString() : string

Response

string

Constructs the object from a string

unserialize( $serialized) 

Implements Serializable interface

Arguments

$serialized