Batch Processing
Batch tools make the difference between item-level status and whole-collection status explicit.
php
use Maxiviper117\ResultFlow\Result;
$results = Result::mapItems($rows, fn (array $row, string $key) => validateRow($row, $key));The batch families
mapItems(...)returns oneResultper input item.mapAll(...)fails fast on the first failure and returns keyed success values.mapCollectErrors(...)processes everything and returns keyed failures.combine(...)andcombineAll(...)aggregate already-builtResultvalues.
What to remember
mapAll(...)andcombine(...)are fail-fast.mapCollectErrors(...)andcombineAll(...)collect all failures;combineAll(...)does not return success values if any input fails.- keys are preserved where the API says they are preserved.