本文整理汇总了PHP中Filters::filter方法的典型用法代码示例。如果您正苦于以下问题:PHP Filters::filter方法的具体用法?PHP Filters::filter怎么用?PHP Filters::filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Filters
的用法示例。
在下文中一共展示了Filters::filter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testOnceHandler
public function testOnceHandler()
{
$rawTitle = ' Hello world!!! ';
$this->filters->once('before_output_title', 'trim');
$this->filters->filter('before_output_title', $rawTitle);
$title = $this->filters->filter('before_output_title', $rawTitle);
self::assertEquals($rawTitle, $title);
}
示例2: testStopPropagation
public function testStopPropagation()
{
$rawTitle = ' Hello world!!! ';
$this->filters->on('before_output_title', 'trim');
$this->filters->on('before_output_title', function ($value) {
throw (new StopPropagation())->setValue($value);
});
$this->filters->on('before_output_title', [$this, 'customFilterHandler']);
$title = $this->filters->filter('before_output_title', $rawTitle);
self::assertEquals('Hello world!!!', $title);
}
示例3: filterMethod
protected function filterMethod($method, $params, $callback, $filters = array())
{
return Filters::filter($this, $method, $params, $callback, $filters);
}
示例4: filterStaticMethod
protected static function filterStaticMethod($method, $params, $callback, $filters = array())
{
return Filters::filter(get_called_class(), $method, $params, $callback, $filters);
}