[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/filter_chain/src/ -> lmbFilterChain.class.php (summary)

(no description)

File Size: 127 lines (3 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

lmbFilterChain:: (6 methods):
  __construct()
  registerFilter()
  getFilters()
  next()
  process()
  run()


Class: lmbFilterChain  - X-Ref

lmbFilterChain is an implementation of InterceptinfFilter design pattern.

lmbFilterChain contains registered filters and controls execution of the chain.
Usually used as a FrontController in Limb based web applications (see web_app package)

lmbFilterChain can be an intercepting filter in its turn as well.

The best way to think about filters is as of a "russian nested doll", e.g:
<code>
// +-Filter A
// | +-Filter B
// | | +-Filter C
// | | |_
// | |_
// |_
</code>
To achieve this sample structure you should write the following code:
<code>
$chain = new lmbFilterChain();
$chain->registerFilter(new A());
$chain->registerFilter(new B());
$chain->registerFilter(new C());
</code>

Remember, it's the filter that decides whether to pass control to the
underlying filter, this is done by calling filter chain instance next()
method.

Usage example:
<code>
lmb_require('limb/filter_chain/src/lmbFilterChain.class.php');
//create new chain
$chain = new lmbFilterChain();
//register filter object in the chain
$chain->registerFilter(new MyFilter());
//register a handle for a filter in the chain
//in this case we can avoid PHP code parsing if
//this filter won't be processed
$chain->registerFilter(new lmbHandle('/path/to/MyFilter'));
//executes the chain
$chain->process();
</code>

__construct()   X-Ref


registerFilter($filter)   X-Ref
Registers filter (or handle on a filter) in the chain.

return: void

getFilters()   X-Ref
Returns registered filters

return: array

next()   X-Ref
Runs next filter in the chain.

return: void

process()   X-Ref
Executes the chain

return: void

run($filter_chain)   X-Ref
Implements lmbInterceptingFilter interface.
Filter chain can be an intercepting filter.

param: object Filter chain instance
return: void



Generated: Tue Oct 7 05:02:03 2008 Cross-referenced by PHPXref 0.7