<?php

namespace App\Service\SnipParser\Generic;

use League\Pipeline\StageInterface;

readonly class ReplaceStage implements StageInterface
{
    // replaces a string with another string
    public function __construct(
        public string $search,
        public string $replace,
    ) {}

    public function __invoke(mixed $payload): string
    {
        return str_replace($this->search, $this->replace, $payload);
    }
}