Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion src/ProcessorPipeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use KaririCode\Contract\Processor\Pipeline;
use KaririCode\Contract\Processor\Processor;
use KaririCode\Contract\Processor\ValidatableProcessor;

class ProcessorPipeline implements Pipeline
{
Expand All @@ -22,7 +23,14 @@ public function process(mixed $input): mixed
{
return array_reduce(
$this->processors,
fn ($carry, Processor $processor) => $processor->process($carry),
static function ($carry, Processor $processor): mixed {
// Reset the processor's state if it's a ValidatableProcessor
if ($processor instanceof ValidatableProcessor) {
$processor->reset();
}

return $processor->process($carry);
},
$input
);
}
Expand Down
Loading