<?php

namespace FiloBlu\Flow\Model\Filters;

/**
 * Class Categories
 * @package FiloBlu\Flow\Model\Filters
 */
class Categories extends AbstractFilter
{
    /**
     * @param $value
     * @param $args
     * @return array|string|string[]
     */
    public function filter($value, $args)
    {

        $v = trim($value ?? '');

        foreach ($args as $key => $val) {

            if ($key === 'separator') {
                return str_replace($val, '|', $v);
            }

            if ($key === 'position_separator') {
                return str_replace($val, '#', $v);
            }
        }

        return $v;
    }

}
