<?php

namespace NoahVet\Reef\Factory\RequestContext;

use Symfony\Component\HttpFoundation\Request;

class KeywordApplier extends AbstractApplier implements KeywordApplierInterface
{
    #[\Override]
    public function apply(Request $request, array $whitelist): string
    {
        if (!isset($whitelist['keywords'])) {
            return '';
        }

        return \trim(\json_decode($request->getContent(), true)['keywords'] ?? '');
    }
}
