class CursorPaginatedDataCollection implements BaseDataCollectable, TransformableData, IncludeableData, ResponsableData, WrappableData, Countable, Transient

Traits

Properties

protected PartialsDefinition|false|null $partialDefinitions

Null before defaults are inspected, false when they are empty, or the mutable definition store.

from  IncludeableData
protected Wrap|null $wrap from  WrappableData
static protected array $macros

The registered string macros.

from  Macroable
protected TValue> $items

Methods

getPartialsDefinition()

Get the current partial definitions.

include(string ...$includes)

Include properties for the next transformation.

includePermanently(string ...$includes)

Include properties for every transformation.

exclude(string ...$excludes)

Exclude lazy properties for the next transformation.

excludePermanently(string ...$excludes)

Exclude lazy properties for every transformation.

only(string ...$only)

Keep only properties for the next transformation.

onlyPermanently(string ...$only)

Keep only properties for every transformation.

except(string ...$except)

Exclude properties for the next transformation.

exceptPermanently(string ...$except)

Exclude properties for every transformation.

includeWhen(string $include, bool|Closure $condition, bool $permanent = false)

Include a property when the condition passes.

excludeWhen(string $exclude, bool|Closure $condition, bool $permanent = false)

Exclude a lazy property when the condition passes.

onlyWhen(string $only, bool|Closure $condition, bool $permanent = false)

Keep only a property when the condition passes.

exceptWhen(string $except, bool|Closure $condition, bool $permanent = false)

Exclude a property when the condition passes.

bool
hasPartialsDefinition()

Determine whether this object has partial definitions.

array
includeProperties()

Get class-owned permanent include definitions.

array
excludeProperties()

Get class-owned permanent exclude definitions.

array
onlyProperties()

Get class-owned permanent only definitions.

array
exceptProperties()

Get class-owned permanent except definitions.

toResponse(Request $request)

Create an HTTP response that represents the data object.

static int
jsonOptions()

Get the JSON serialization options for the resource response.

void
withResponse(Request $request, JsonResponse $response)

Customize the outgoing resource response.

static array|null
allowedRequestIncludes()

Get the request properties that may be included.

static array|null
allowedRequestExcludes()

Get the request properties that may be excluded.

static array|null
allowedRequestOnly()

Get the request properties allowed by an only selection.

static array|null
allowedRequestExcept()

Get the request properties allowed by an except selection.

responseItems(BaseDataCollectable $data)

Get original collection items without transforming or enumerating them twice.

array
transform(TransformationContextFactory|TransformationContext|null $transformationContext = null)

Transform the data object to an array.

array
all()

Get all visible properties without transforming their values.

array
toArray()

Get the data object as an array.

string
toJson(int $options = 0)

Convert the data object to its JSON representation.

array
jsonSerialize()

Get the data that should be serialized to JSON.

string
getDataClass()

Get the data class stored by the collection.

getIterator()

Get an iterator for the data items.

iterable
itemsForIteration()

Get the underlying items without transforming them.

int
count()

Get the number of data items on the current page.

withoutWrapping()

Disable wrapping for the data object.

wrap(string $key)

Wrap the data object with the given key.

getWrap()

Get the current wrapping definition.

static void
macro(string $name, callable|object $macro)

Register a custom macro.

static void
mixin(object $mixin, bool $replace = true)

Mix another object into the class.

static bool
hasMacro(string $name)

Check if macro is registered.

static void
flushMacros()

Flush the existing macros.

static mixed
__callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

mixed
__call(string $method, array $parameters)

Dynamically handle calls to the class.

__construct(string $dataClass, AbstractCursorPaginator $items)

Create a typed cursor-paginated data collection.

items()

Get the underlying cursor paginator.

Details

abstract PartialsDefinition getPartialsDefinition()

Get the current partial definitions.

Return Value

PartialsDefinition

ForwardsToPartialsDefinition include(string ...$includes)

Include properties for the next transformation.

Parameters

string ...$includes

Return Value

ForwardsToPartialsDefinition

ForwardsToPartialsDefinition includePermanently(string ...$includes)

Include properties for every transformation.

Parameters

string ...$includes

Return Value

ForwardsToPartialsDefinition

ForwardsToPartialsDefinition exclude(string ...$excludes)

Exclude lazy properties for the next transformation.

Parameters

string ...$excludes

Return Value

ForwardsToPartialsDefinition

ForwardsToPartialsDefinition excludePermanently(string ...$excludes)

Exclude lazy properties for every transformation.

Parameters

string ...$excludes

Return Value

ForwardsToPartialsDefinition

ForwardsToPartialsDefinition only(string ...$only)

Keep only properties for the next transformation.

Parameters

string ...$only

Return Value

ForwardsToPartialsDefinition

ForwardsToPartialsDefinition onlyPermanently(string ...$only)

Keep only properties for every transformation.

Parameters

string ...$only

Return Value

ForwardsToPartialsDefinition

ForwardsToPartialsDefinition except(string ...$except)

Exclude properties for the next transformation.

Parameters

string ...$except

Return Value

ForwardsToPartialsDefinition

ForwardsToPartialsDefinition exceptPermanently(string ...$except)

Exclude properties for every transformation.

Parameters

string ...$except

Return Value

ForwardsToPartialsDefinition

ForwardsToPartialsDefinition includeWhen(string $include, bool|Closure $condition, bool $permanent = false)

Include a property when the condition passes.

Parameters

string $include
bool|Closure $condition
bool $permanent

Return Value

ForwardsToPartialsDefinition

ForwardsToPartialsDefinition excludeWhen(string $exclude, bool|Closure $condition, bool $permanent = false)

Exclude a lazy property when the condition passes.

Parameters

string $exclude
bool|Closure $condition
bool $permanent

Return Value

ForwardsToPartialsDefinition

ForwardsToPartialsDefinition onlyWhen(string $only, bool|Closure $condition, bool $permanent = false)

Keep only a property when the condition passes.

Parameters

string $only
bool|Closure $condition
bool $permanent

Return Value

ForwardsToPartialsDefinition

ForwardsToPartialsDefinition exceptWhen(string $except, bool|Closure $condition, bool $permanent = false)

Exclude a property when the condition passes.

Parameters

string $except
bool|Closure $condition
bool $permanent

Return Value

ForwardsToPartialsDefinition

in IncludeableData at line 24
bool hasPartialsDefinition()

Determine whether this object has partial definitions.

Return Value

bool

in IncludeableData at line 88
protected array includeProperties()

Get class-owned permanent include definitions.

Return Value

array

in IncludeableData at line 96
protected array excludeProperties()

Get class-owned permanent exclude definitions.

Return Value

array

in IncludeableData at line 104
protected array onlyProperties()

Get class-owned permanent only definitions.

Return Value

array

in IncludeableData at line 112
protected array exceptProperties()

Get class-owned permanent except definitions.

Return Value

array

in ResponsableData at line 28
JsonResponse toResponse(Request $request)

Create an HTTP response that represents the data object.

Parameters

Request $request

Return Value

JsonResponse

in ResponsableData at line 67
static int jsonOptions()

Get the JSON serialization options for the resource response.

Return Value

int

in ResponsableData at line 75
void withResponse(Request $request, JsonResponse $response)

Customize the outgoing resource response.

Parameters

Request $request
JsonResponse $response

Return Value

void

in ResponsableData at line 82
static array|null allowedRequestIncludes()

Get the request properties that may be included.

Return Value

array|null

in ResponsableData at line 90
static array|null allowedRequestExcludes()

Get the request properties that may be excluded.

Return Value

array|null

in ResponsableData at line 98
static array|null allowedRequestOnly()

Get the request properties allowed by an only selection.

Return Value

array|null

in ResponsableData at line 106
static array|null allowedRequestExcept()

Get the request properties allowed by an except selection.

Return Value

array|null

in ResponsableData at line 116
protected Collection responseItems(BaseDataCollectable $data)

Get original collection items without transforming or enumerating them twice.

Parameters

BaseDataCollectable $data

Return Value

Collection

in TransformableData at line 20
array transform(TransformationContextFactory|TransformationContext|null $transformationContext = null)

Transform the data object to an array.

Parameters

TransformationContextFactory|TransformationContext|null $transformationContext

Return Value

array

in TransformableData at line 38
array all()

Get all visible properties without transforming their values.

Return Value

array

in TransformableData at line 52
array toArray()

Get the data object as an array.

Return Value

array

in TransformableData at line 60
string toJson(int $options = 0)

Convert the data object to its JSON representation.

Parameters

int $options

Return Value

string

in TransformableData at line 70
array jsonSerialize()

Get the data that should be serialized to JSON.

Return Value

array

string getDataClass()

Get the data class stored by the collection.

Return Value

string

Generator getIterator()

Get an iterator for the data items.

Return Value

Generator

abstract protected iterable itemsForIteration()

Get the underlying items without transforming them.

Return Value

iterable

PaginatedDataCollectable through(Closure $through)

No description

Parameters

Closure $through

Return Value

PaginatedDataCollectable

int count()

Get the number of data items on the current page.

Return Value

int

in WrappableData at line 17
WrappableData withoutWrapping()

Disable wrapping for the data object.

Return Value

WrappableData

in WrappableData at line 27
WrappableData wrap(string $key)

Wrap the data object with the given key.

Parameters

string $key

Return Value

WrappableData

in WrappableData at line 37
Wrap getWrap()

Get the current wrapping definition.

Return Value

Wrap

in Macroable at line 28
static void macro(string $name, callable|object $macro)

Register a custom macro.

Boot-only. Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.

Parameters

string $name
callable|object $macro

Return Value

void

in Macroable at line 41
static void mixin(object $mixin, bool $replace = true)

Mix another object into the class.

Boot-only. Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

in Macroable at line 57
static bool hasMacro(string $name)

Check if macro is registered.

Parameters

string $name

Return Value

bool

in Macroable at line 68
static void flushMacros()

Flush the existing macros.

Boot or tests only. Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.

Return Value

void

in Macroable at line 78
static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in Macroable at line 103
mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

at line 54
__construct(string $dataClass, AbstractCursorPaginator $items)

Create a typed cursor-paginated data collection.

Parameters

string $dataClass
AbstractCursorPaginator $items

at line 70
AbstractCursorPaginator items()

Get the underlying cursor paginator.