The access code collection holds access code instances.
An instance of this collection can update the entry state of all access codes inside of it with one single API request.
| package |
NextEvent\PHPSDK\Model |
|---|
__construct(string $modelClass, array $instanceArgs = null, array $data = null, \NextEvent\PHPSDK\Rest\Client $restClient = null)
stringThe class of the models in this collection.
arrayAdditional instance arguments to pass to the model constructor.
arrayOptional response data to initialize the collection with.
count() : integer
integer
current() : mixed
mixed
fetchNextPage() : boolean
| Throws |
|
|---|
booleanWhether the next page has been fetched or not. false means, we have no next page to fetch.
filter(callable $callback) : \NextEvent\PHPSDK\Model\Collection
callable
\NextEvent\PHPSDK\Model\CollectionA new collection instance with the filtered content.
getAutofetch() : boolean
boolean
getCurrentPage() : string
string
getLastPage() : string
string
getModelClass() : string
string
getNextPage() : string
string
getPage() : integer
integer
getPages() : integer
integer
getPageSize() : integer
integer
getPreviousPage() : string
string
key() : integer
integer
map(callable $callback) : array
This works similar to PHP's array_map() function and allows to
transform the collection with a given callback function.
| Throws |
|
|---|
callableCallback function to run for each element. Receives the current element as argument.
arraycontaining all the elements of the collection1 after applying the callback function to each one
next() : void
offsetExists(mixed $offset) : boolean
mixedThe offset to check.
boolean
offsetGet(mixed $offset) : mixed
mixedThe offset to get the value at.
mixed
offsetSet(mixed $offset, mixed $value) : void
Only instances of the current model class can be set in this collection.
| Throws |
|
|---|
mixedThe offset to set the value at.
mixedThe value to set.
offsetUnset(mixed $offset) : void
mixedThe offset at which to remove the value.
rewind() : void
setAutofetch(boolean $autoFetch)
If enabled, iterating the collection will automatically fetch all pages and thus list all records that match the request/query.
boolean
setData(array $data, boolean $reset = true) : void
This method assumes that the given data holds the structure of a HAL response.
| Throws |
|
|---|
array
booleanWhether to reset the internal models array.
setEntryState(\NextEvent\PHPSDK\Model\Device $device, integer $entryState = null, string $connection = 'online', array|null $categories = null, string $processed = null) : \NextEvent\PHPSDK\Model\AccessCodeCollection
You will receive validation messages for each access code which failed to update the entry state.
| see |
\NextEvent\PHPSDK\Model\AccessCode::ENTRY_IN
and \NextEvent\PHPSDK\Model\AccessCode::ENTRY_OUTwhen passing $entryState |
|---|---|
| Throws |
|
integerThe 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.
stringOptional connection parameter. Default is 'online'.
array|nullOptional list of categories to validate. By default the category id of this access code will be set.
stringOptional processed time. Default is the current time of the server this code runs on.
\NextEvent\PHPSDK\Model\AccessCodeCollection
setInstanceArguments(array $arguments) : void
You can pass a function as a value, which has to return the value type expected by the constructor of the model. The raw model data will be passed to that function.
array
valid() : boolean
If the iterator position is at the end of the page, but not at the end of the whole collection, the next page will be fetched.
boolean