<?php

namespace App\Service\SnipParser\Generic;

use League\Pipeline\StageInterface;

class HtmlEscapeStage implements StageInterface
{
    public function __invoke(mixed $payload): string
    {
        // https://www.php.net/manual/en/function.htmlspecialchars.php
        return htmlspecialchars($payload, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML5, 'UTF-8');
    }
}