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)
string
The class of the models in this collection.
array
Additional instance arguments to pass to the model constructor.
array
Optional response data to initialize the collection with.
count() : integer
integer
current() : mixed
mixed
fetchNextPage() : boolean
Throws |
|
---|
boolean
Whether 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\Collection
A 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 |
|
---|
callable
Callback function to run for each element. Receives the current element as argument.
array
containing all the elements of the collection1 after applying the callback function to each one
next() : void
offsetExists(mixed $offset) : boolean
mixed
The offset to check.
boolean
offsetGet(mixed $offset) : mixed
mixed
The 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 |
|
---|
mixed
The offset to set the value at.
mixed
The value to set.
offsetUnset(mixed $offset) : void
mixed
The 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
boolean
Whether 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 |
|
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.
string
Optional connection parameter. Default is 'online'.
array|null
Optional list of categories to validate. By default the category id of this access code will be set.
string
Optional 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