Added post-filter support.
authorRoland Haeder <roland@mxchange.org>
Sun, 24 May 2015 17:55:58 +0000 (19:55 +0200)
committerRoland Haeder <roland@mxchange.org>
Sun, 24 May 2015 17:55:58 +0000 (19:55 +0200)
Signed-off-by: Roland H├Ąder <roland@mxchange.org>
inc/classes/main/filter/class_FilterChain.php

index 1c24333..e80c956 100644 (file)
@@ -55,6 +55,16 @@ class FilterChain extends BaseFrameworkSystem implements Registerable {
                $this->pushValueToGenericArrayKey('filters', 'generic', 'dummy', $filterInstance);
        }
 
                $this->pushValueToGenericArrayKey('filters', 'generic', 'dummy', $filterInstance);
        }
 
+       /**
+        * Add a new post-filter
+        *
+        * @param       $filerInstance  An instance of a post-filter class
+        * @return      void
+        */
+       public final function addPostFilter (Filterable $filterInstance) {
+               $this->pushValueToGenericArrayKey('filters', 'post', 'dummy', $filterInstance);
+       }
+
        /**
         * "Getter" for filters array
         *
        /**
         * "Getter" for filters array
         *
@@ -74,6 +84,25 @@ class FilterChain extends BaseFrameworkSystem implements Registerable {
                return $filters;
        }
 
                return $filters;
        }
 
+       /**
+        * "Getter" for post-filters array
+        *
+        * @return      $filters        The filters array holding all post-filter instances
+        */
+       protected function getPostFilters () {
+               // Default is nothing found
+               $filters = array();
+
+               // Are some filters set?
+               if ($this->isValidGenericArrayKey('filters', 'post', 'dummy')) {
+                       // Then get them
+                       $filters = $this->getGenericArrayKey('filters', 'post', 'dummy');
+               } // END - if
+
+               // Return it
+               return $filters;
+       }
+
        /**
         * Process all added filters. Please note that filters must throw
         * FilterChainException if they need to interrupt the filter chain.
        /**
         * Process all added filters. Please note that filters must throw
         * FilterChainException if they need to interrupt the filter chain.