Source of file FilterChain.php
Size: 1,200 Bytes - Last Modified: 2015-12-22T09:12:14-05:00
../src/FilterChain.php
1234567891011121314151617181920212223242526272829303132333435363738394041
Covered by 8 test(s):
4243
Covered by 8 test(s):
4445464748495051525354
Covered by 3 test(s):
55
Covered by 3 test(s):
56
Covered by 3 test(s):
5758
Covered by 3 test(s):
596061
| <?php /** * Base Filter * * @category MvcLite * @package Lib * @subpackage Filter * @since File available since release 1.0.1 * @author Cory Collier <corycollier@corycollier.com> */ namespace MvcLite; /** * Base Filter * * @category MvcLite * @package Lib * @subpackage Filter * @since Class available since release 1.0.1 * @author Cory Collier <corycollier@corycollier.com> */ class FilterChain extends ObjectAbstract { const MSG_ERR_FILTER_NOT_FOUND = "Requested filter [%s] not found"; /** * holds the list of filters * * @var array */ protected $filters = []; /** * adds a filter to the chain * * @param \MvcLite\FilterAbstract $filter */ public function addFilter(FilterAbstract $filter) { $this->filters[] = $filter; return $this; } /** * filters a chain * * @param string $word */ public function filter($word = '') { // iterate through the filters, triming the word as defined foreach ($this->filters as $filter) { $word = $filter->filter($word); } return $word; } } |