* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class FilterChain extends BaseFrameworkSystem implements Registerable {
- /**
- * All filters together
- */
- private $filters = array();
-
/**
* Protected constructor
*
* @return void
*/
public final function addFilter (Filterable $filterInstance) {
- $this->filters[] = $filterInstance;
+ $this->pushValueToGenericArrayElement('filters', 'generic', 'dummy', $filterInstance);
}
/**
* @return $filters The filters array holding all filter instances
*/
protected function getFilters () {
- return $this->filters;
+ return $this->getGenericArrayKey('filters', 'generic', 'dummy');
}
/**
*/
public function processFilters (Requestable $requestInstance, Responseable $responseInstance) {
// Run all filters
- //* DEBUG */ self::createDebugInstance(__CLASS__)->debugOutput('COUNT=' . count($this->filters));
+ //* DEBUG */ self::createDebugInstance(__CLASS__)->debugOutput('COUNT=' . $this->countGenericArray('filters'));
foreach ($this->getFilters() as $filterInstance) {
+ // Must be an instance of Filterable
+ assert($filterInstance instanceof Filterable);
+
// Try to execute this filter
try {
//* DEBUG */ self::createDebugInstance(__CLASS__)->debugOutput('FILTER: ' . $filterInstance->__toString() . ': Processing started.');