当前位置: 首页>>代码示例>>PHP>>正文


PHP Filters::rewind方法代码示例

本文整理汇总了PHP中Filters::rewind方法的典型用法代码示例。如果您正苦于以下问题:PHP Filters::rewind方法的具体用法?PHP Filters::rewind怎么用?PHP Filters::rewind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Filters的用法示例。


在下文中一共展示了Filters::rewind方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Collects a set of filters to iterate. Creates a filter chain for the given class/method,
  * executes it, and returns the value.
  *
  * @param mixed $class The class for which this filter chain is being created. If this is the
  *        result of a static method call, `$class` should be a string. Otherwise, it should
  *        be the instance of the object making the call.
  * @param array $params An associative array of the given method's parameters.
  * @param array $options The configuration options with which to create the filter chain.
  *        Mainly, these options allow the `Filters` object to be queried for details such as
  *        which class / method initiated it. Available keys:
  *        - `'class'`: The name of the class that initiated the filter chain.
  *        - `'method'`: The name of the method that initiated the filter chain.
  *        - `'data'` _array_: An array of callable objects (usually closures) to be iterated
  *          through. By default, execution will be nested such that the first item will be
  *          executed first, and will be the last to return.
  * @return Returns the value returned by the first closure in `$options['data`]`.
  */
 public static function run($class, $params, array $options = array())
 {
     $defaults = array('class' => null, 'method' => null, 'data' => array());
     $options += $defaults;
     $lazyFilterCheck = is_string($class) && $options['method'];
     if ($lazyFilterCheck && isset(static::$_lazyFilters[$class][$options['method']])) {
         $filters = static::$_lazyFilters[$class][$options['method']];
         unset(static::$_lazyFilters[$class][$options['method']]);
         $options['data'] = array_merge($filters, $options['data']);
         foreach ($filters as $filter) {
             $class::applyFilter($options['method'], $filter);
         }
     }
     $chain = new Filters($options);
     $next = $chain->rewind();
     return $next($class, $params, $chain);
 }
开发者ID:unionofrad,项目名称:lithium,代码行数:35,代码来源:Filters.php


注:本文中的Filters::rewind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。