Page MenuHomeDevCentral

Run a callable on each item of a collection

Authored by dereckson on Jul 4 2023, 21:03.
Referenced Files
Unknown Object (File)
Fri, Sep 29, 00:30
Unknown Object (File)
Sun, Sep 24, 16:43
Unknown Object (File)
Fri, Sep 22, 22:48
Unknown Object (File)
Fri, Sep 22, 08:08
Unknown Object (File)
Wed, Sep 20, 05:22
Unknown Object (File)
Wed, Sep 20, 00:46
Unknown Object (File)
Sun, Sep 10, 01:58
Unknown Object (File)
Sat, Sep 9, 20:59



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.

Diff Detail

rKERUALD Keruald libraries development repository
Lint Not Applicable
Tests Not Applicable

Event Timeline

dereckson created this revision.
This revision is now accepted and ready to land.Jul 4 2023, 21:04
This revision was landed with ongoing or failed builds.Jul 4 2023, 21:04
This revision was automatically updated to reflect the committed changes.