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
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
Unknown Object (File)
Sun, Nov 17, 12:36
Unknown Object (File)
Tue, Nov 12, 12:26
Unknown Object (File)
Mon, Nov 11, 12:06
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 Warnings
SeverityLocationCodeMessage
Warningomnitools/src/Collections/MultipleOperation.php:48PHPCS.W.Generic.Files.LineLength.TooLongGeneric.Files.LineLength.TooLong
Warningomnitools/src/Collections/MultipleOperation.php:49PHPCS.W.Generic.Files.LineLength.TooLongGeneric.Files.LineLength.TooLong
Unit
Tests Passed
Branch
main
Build Status
Buildable 5092
Build 5373: arc lint + arc unit

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.