<?php

namespace FiloBlu\Flow\Model\Filters;

/**
 * Class ValueReplace
 * @package FiloBlu\Flow\Model\Filters
 */
class ValueReplace extends AbstractFilter
{

    /**
     * @param $value
     * @param $args
     * @return mixed|string
     */
    public function filter($value, $args)
    {
        $v = trim($value ?? '');

        if ($args && count($args)) {
            return $args[$v] ?? $v;
        }

        return $v;
    }

}
