This trait fulfills the [\Iterator](http://php.net/manual/en/class.iterator.php) interface and returns results as a page of items.

Trait
Methods
public __construct(callable $resultMapper, callable $call, array $callOptions, array $config = [])
 


    public current()
     
    Get the current page.

    • return array|null
    public key()
     
    Get the key current page's key.

    • return int
    public next()
     
    Advances to the next page.

    • return null
    public nextResultToken()
     
    Fetch the token used to get the next set of results.

    • return string|null
    public rewind()
     
    Rewind the iterator.

    • return null
    public valid()
     
    Determines if the current position is valid.

    • return bool
    Properties
    private $call
     


    • var callable
    private $callOptions
     


    • var array
    private $config
     


    • var array
    private $initialResultToken
     


    • var string|null
    private $itemCount
     


    • var int
    private $itemsPath
     


    • var array
    private $nextResultTokenPath
     


    • var array
    private $page
     


    • var array|null
    private $position
     


    • var int
    private $resultMapper
     


    • var callable
    private $resultTokenPath
     


    • var array
    Methods
    private arrayFilterRemoveNull(array $arr)
     
    Just like array_filter(), but preserves falsey values except null.

    • return array
    private arrayMergeRecursive(array $array1, array $array2)
     
    A method, similar to PHP's `array_merge_recursive`, with two differences.

    1. Keys in $array2 take precedence over keys in $array1.
    2. Non-array keys found in both inputs are not transformed into an array
      and appended. Rather, the value in $array2 is used.
    • return array
    private determineNextResultToken(array $results, $shouldContinue = true)
     


    • return null
    private executeCall()
     
    Executes the provided call to get a set of results.

    • return array
    private get(array $path, array $array)
     


    • return mixed
    private isAssoc(array $arr)
     
    Determine whether given array is associative.

    • return bool
    private mapResults(array $results)
     


    • return array
    private pluck( $key, array $arr, $isRequired = true)
     
    Pluck a value out of an array.

    • return mixed
    • throws InvalidArgumentException
    private pluckArray(array $keys, $arr)
     
    Pluck a subset of an array.

    • return array
    private set(array $path, array $array, $value)
     


    • return null
    © 2020 Bruce Wells
    Search Namespaces \ Classes
    ConfigurationNumbers (0-9.) only