class PendingScopedFeatureInteraction

Properties

protected Decorator $driver

The feature driver.

protected mixed[] $scope

The feature interaction scope.

Methods

__construct(Decorator $driver)

Create a new Pending Scoped Feature Interaction instance.

for(mixed $scope)

Add scope to the feature interaction.

array
load(UnitEnum|string|array $features)

Load the feature into memory.

array
loadMissing(UnitEnum|string|array $features)

Load the missing features into memory.

array
loadAll()

Load all defined features into memory.

mixed
value(UnitEnum|string $feature)

Get the value of the flag.

array
values(array $features)

Get the values of the flag.

array
all()

Retrieve all the features and their values.

bool
active(UnitEnum|string $feature)

Determine if the feature is active.

bool
allAreActive(array $features)

Determine if all the features are active.

bool
someAreActive(array $features)

Determine if any of the features are active.

bool
inactive(UnitEnum|string $feature)

Determine if the feature is inactive.

bool
allAreInactive(array $features)

Determine if all the features are inactive.

bool
someAreInactive(array $features)

Determine if any of the features are inactive.

mixed
when(UnitEnum|string $feature, Closure $whenActive, Closure|null $whenInactive = null)

Apply the callback if the feature is active.

mixed
unless(UnitEnum|string $feature, Closure $whenInactive, Closure|null $whenActive = null)

Apply the callback if the feature is inactive.

void
activate(UnitEnum|string|array $feature, mixed $value = true)

Activate the feature.

void
deactivate(UnitEnum|string|array $feature)

Deactivate the feature.

void
forget(UnitEnum|string|array $features)

Forget the flags value.

void
loadMissingBeforeReading(array $features)

Load the missing values of the given features before they are read one at a time.

array
normalize(UnitEnum|string|array $features)

Normalize the given features to their scalar names.

array
scope()

The scope to pass to the driver.

Details

at line 31
__construct(Decorator $driver)

Create a new Pending Scoped Feature Interaction instance.

Parameters

Decorator $driver

at line 41
PendingScopedFeatureInteraction for(mixed $scope)

Add scope to the feature interaction.

Parameters

mixed $scope

Return Value

PendingScopedFeatureInteraction

at line 55
array load(UnitEnum|string|array $features)

Load the feature into memory.

Parameters

UnitEnum|string|array $features

Return Value

array

at line 71
array loadMissing(UnitEnum|string|array $features)

Load the missing features into memory.

Parameters

UnitEnum|string|array $features

Return Value

array

at line 88
array loadAll()

Load all defined features into memory.

Each scope loads only the features whose resolvers accept it.

Return Value

array

at line 105
mixed value(UnitEnum|string $feature)

Get the value of the flag.

Parameters

UnitEnum|string $feature

Return Value

mixed

at line 116
array values(array $features)

Get the values of the flag.

Parameters

array $features

Return Value

array

at line 141
array all()

Retrieve all the features and their values.

Return Value

array

at line 151
bool active(UnitEnum|string $feature)

Determine if the feature is active.

Parameters

UnitEnum|string $feature

Return Value

bool

at line 161
bool allAreActive(array $features)

Determine if all the features are active.

Parameters

array $features

Return Value

bool

at line 183
bool someAreActive(array $features)

Determine if any of the features are active.

Parameters

array $features

Return Value

bool

at line 205
bool inactive(UnitEnum|string $feature)

Determine if the feature is inactive.

Parameters

UnitEnum|string $feature

Return Value

bool

at line 215
bool allAreInactive(array $features)

Determine if all the features are inactive.

Parameters

array $features

Return Value

bool

at line 237
bool someAreInactive(array $features)

Determine if any of the features are inactive.

Parameters

array $features

Return Value

bool

at line 259
mixed when(UnitEnum|string $feature, Closure $whenActive, Closure|null $whenInactive = null)

Apply the callback if the feature is active.

Parameters

UnitEnum|string $feature
Closure $whenActive
Closure|null $whenInactive

Return Value

mixed

at line 275
mixed unless(UnitEnum|string $feature, Closure $whenInactive, Closure|null $whenActive = null)

Apply the callback if the feature is inactive.

Parameters

UnitEnum|string $feature
Closure $whenInactive
Closure|null $whenActive

Return Value

mixed

at line 285
void activate(UnitEnum|string|array $feature, mixed $value = true)

Activate the feature.

Parameters

UnitEnum|string|array $feature
mixed $value

Return Value

void

at line 303
void deactivate(UnitEnum|string|array $feature)

Deactivate the feature.

Parameters

UnitEnum|string|array $feature

Return Value

void

at line 321
void forget(UnitEnum|string|array $features)

Forget the flags value.

Parameters

UnitEnum|string|array $features

Return Value

void

at line 337
protected void loadMissingBeforeReading(array $features)

Load the missing values of the given features before they are read one at a time.

A single feature and scope is left to the read itself, which loads it the same way.

Parameters

array $features

Return Value

void

at line 350
protected array normalize(UnitEnum|string|array $features)

Normalize the given features to their scalar names.

Parameters

UnitEnum|string|array $features

Return Value

array

at line 360
protected array scope()

The scope to pass to the driver.

Return Value

array