HomeDevCentral

Run a callable on each item of a collection

Description

Run a callable on each item of a collection

Summary:
MultipleOperation is a wrapper to apply a callable,
and consolidate the boolean result.

This works like a foreach loop or functions like array_walk, iterator_apply,
with the difference it tries to still apply the callable on failure, and
report failure afterwards.

Use case: PSR-16 cache allows to delete several keys,
we can return true if all has been deleted and false
if at least one operation failed.

Test Plan:
Units tests provided.

Tested in keruald/cache draft implementation.

Reviewers: dereckson

Differential Revision: https://devcentral.nasqueron.org/D3229

Details

Provenance
derecksonAuthored on Jul 4 2023, 20:59
derecksonPushed on Jul 4 2023, 21:04
Differential Revision
D3229: Run a callable on each item of a collection
Parents
rKERUALD14b3b96d96a6: Make Boolean immutable
Branches
Unknown
Tags
Unknown