public function register($name, $filter)
{
if (array_key_exists($name, $this->filters)) {
throw new \InvalidArgumentException(sprintf('Filter with the name "%s" is already defined.', $name));
}
if (is_string($filter) && !class_exists($filter)) {
throw new \InvalidArgumentException(sprintf('Unknown filter with the class name "%s".', $filter));
}
$this->filters[$name] = $filter;
}