mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-06-26 06:29:24 +02:00
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.
23 lines
674 B
PHP
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);
|
|
}
|