Page MenuHomeDevCentral

Run a callable on each item of a collection
ClosedPublic

Authored by dereckson on Jul 4 2023, 21:03.
Tags
None
Referenced Files
F3787123: D3229.id8288.diff
Tue, Nov 26, 17:52
F3785803: D3229.diff
Tue, Nov 26, 10:55
Unknown Object (File)
Sat, Nov 23, 07:09
Unknown Object (File)
Tue, Nov 19, 13:41
Unknown Object (File)
Tue, Nov 19, 05:04
Unknown Object (File)
Sun, Nov 17, 17:11
Unknown Object (File)
Sun, Nov 17, 16:52
Unknown Object (File)
Sun, Nov 17, 12:50
Subscribers
None

Details

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.

Diff Detail

Repository
rKERUALD Keruald libraries development repository
Lint
Lint Not Applicable
Unit
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.