AccessCode

Extends \NextEvent\PHPSDK\Model\Model

Access code model

An access code is used in the entrance check process. Each access code owns a (bar)code, a category id and a state. A Gate is responsible for invalidating, i.e. modifying the entry_state, of such an access code.

package

NextEvent\PHPSDK\Model

Methods

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

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

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) 
inherited

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
inherited

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

Get the access from date for this access code

getAccessFrom() : \NextEvent\PHPSDK\Model\DateTime|null

Get the access to date for this access code

getAccessTo() : \NextEvent\PHPSDK\Model\DateTime|null

Get the category id for this access code

getCategoryId() : integer

Response

integer

Get the changed date of this access code

getChangedDate() : \NextEvent\PHPSDK\Model\DateTime|null

Get the code, i.e barcode, for this access code

getCode() : string

Response

string

Get the creation data of this access code

getCreatedDate() : \NextEvent\PHPSDK\Model\DateTime|null

Get the device id for the first device this access code has been processed at

getDeviceId() : integer

Response

integer

Get the amount of entries for this access code

getEntries() : integer|null

Response

integer|null

Get the entry state for this access code

getEntryState() : integer

Get the gate id for the first gate this access code has been processed at

getGateId() : integer|null

Response

integer|null

Get the unique identifier for this access code

getId() : integer

Response

integer

Get the name of the gate this access code has previously been processed at

getLastGate() : string|null

Response

string|null

Get the time this access code has previously been processed

getLastStateChange() : \NextEvent\PHPSDK\Model\DateTime|null

Get the price id for this access code

getPriceId() : integer|null

Response

integer|null

Get the first processed time for this access code

getProcessed() : \NextEvent\PHPSDK\Model\DateTime|null

Get the state for this access code

getState() : integer

Check model state if it is valid

isValid() : boolean
inherited abstract

Response

boolean

String representation of object

serialize() : string
inherited

Implements Serializable interface

Response

string

Updates the `access_from` date for this access code.

setAccessFrom(\NextEvent\PHPSDK\Model\DateTime|string|null $date) : \NextEvent\PHPSDK\Model\AccessCode
Throws
\NextEvent\PHPSDK\Exception\AccessCodeValidateException

If no rest client has been set on this model.

Arguments

$date

\NextEvent\PHPSDK\Model\DateTime|string|null

The new access_from date.

Response

\NextEvent\PHPSDK\Model\AccessCode

Updates the `access_to` date for this access code.

setAccessTo(\NextEvent\PHPSDK\Model\DateTime|string|null $date) : \NextEvent\PHPSDK\Model\AccessCode
Throws
\NextEvent\PHPSDK\Exception\AccessCodeValidateException

If no rest client has been set on this model.

Arguments

$date

\NextEvent\PHPSDK\Model\DateTime|string|null

The new access_to date.

Response

\NextEvent\PHPSDK\Model\AccessCode

Updates the entry state of this access code via the given device at the logged in gate.

setEntryState(\NextEvent\PHPSDK\Model\Device $device, integer $entryState = null, string $connection = 'online', array|null $categories = null, string $processed = null) : \NextEvent\PHPSDK\Model\AccessCode

If the entry state could not be updated, you will receive a validation message from the API.

see \NextEvent\PHPSDK\Model\AccessCode::ENTRY_IN

and

\NextEvent\PHPSDK\Model\AccessCode::ENTRY_OUT

when passing $entryState

Throws
\NextEvent\PHPSDK\Exception\AccessCodeValidateException

If the device is not logged in.
If $entryState is not set but the gate mode is both.
If an invalid $entryState has been passed.
If no rest client has been set on this model.

Arguments

$device

\NextEvent\PHPSDK\Model\Device

The device on which this code has to be validated.

$entryState

integer

The new entry state of the code. If the mode of the gate is not both, the mode of the gate will be used by default.

$connection

string

Optional connection parameter. Default is 'online'.

$categories

array|null

Optional list of categories to validate. By default the category id of this access code will be set.

$processed

string

Optional processed time. Default is the current time of the server this code runs on.

Response

\NextEvent\PHPSDK\Model\AccessCode

Set the rest client for this access code, it may be validated via the api.

setRestClient(\NextEvent\PHPSDK\Rest\Client $restClient) : \NextEvent\PHPSDK\Model\AccessCode

Convert model to an Array

toArray() : array
inherited

Response

array

Convert the model for logging

toLogContext() : array
inherited

Implements the LogContextInterface interface

Response

array

Represent the model as string

toString() : string
inherited

Response

string

Constructs the object from a string

unserialize( $serialized) 
inherited

Implements Serializable interface

Arguments

$serialized

Constants

Constant for indicating the state 'valid'.

STATE_VALID
var

Constant for indicating the state 'cancelled'.

STATE_CANCELLED
var

Constant for indicating the state 'external'.

STATE_EXTERNAL
var

Constant for indicating the entry state 'in'.

ENTRY_IN
var

Constant for indicating the entry state 'out'.

ENTRY_OUT
var

Constant for indicating no entry state.

ENTRY_NONE
var