silverstripe-framework/src/View/Parsers/FilterInterface.php
Robbie Averill 4d5d7a34a1 NEW Add FilterInterface and retrofit into URLSegmentFilter
There are other filters in the core SilverStripe product, e.g. FileNameFilter in silverstripe/assets
which would benefit from having a common filter interface. This retrofits one for URLSegmentFilter
in framework. I have not added any PHP 7 syntax in method signatures to avoid breaking backwards
compatibility.
2019-10-04 10:51:24 +13:00

23 lines
674 B
PHP

<?php
namespace SilverStripe\View\Parsers;
/**
* A FilterInterface is given an input string and returns a filtered string. Replacements will be provided and
* performed (typically in regex format), and transliteration may be used as a separate service to replace
* characters rather than remove them.
*
* For example implementations, see {@link URLSegmentFilter}.
*/
interface FilterInterface
{
/**
* Performs a set of replacement rules against the input string, applying transliteration if a service is
* provided, and returns the filtered result.
*
* @param string $input
* @return string
*/
public function filter($input);
}