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)
Mon, Dec 16, 23:39
Unknown Object (File)
Wed, Dec 11, 01:52
Unknown Object (File)
Mon, Dec 9, 00:50
Unknown Object (File)
Mon, Dec 2, 21:42
Unknown Object (File)
Mon, Dec 2, 08:00
Unknown Object (File)
Tue, Nov 26, 17:52
Unknown Object (File)
Tue, Nov 26, 10:55
Unknown Object (File)
Nov 23 2024, 07:09
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.