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
F3313302: D3229.diff
Fri, Jul 5, 18:29
F3312703: D3229.id.diff
Fri, Jul 5, 12:50
Unknown Object (File)
Thu, Jul 4, 05:36
Unknown Object (File)
Wed, Jul 3, 14:36
Unknown Object (File)
Wed, Jul 3, 09:27
Unknown Object (File)
Wed, Jul 3, 08:38
Unknown Object (File)
Wed, Jul 3, 03:41
Unknown Object (File)
Tue, Jul 2, 21:29
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.