3 namespace CoreFramework\Registration;
5 // Import framework stuff
6 use CoreFramework\Object\BaseFrameworkSystem;
9 * A general registration class.
11 * @author Roland Haeder <webmaster@shipsimu.org>
13 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
14 * @license GNU GPL 3.0 or any newer version
15 * @link http://www.shipsimu.org
17 * This program is free software: you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation, either version 3 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program. If not, see <http://www.gnu.org/licenses/>.
30 class BaseRegistration extends BaseFrameworkSystem {
32 * Pre-registration filter chain
34 private $preRegistrationFilter = NULL;
37 * Pre-registration filter chain
39 private $postRegistrationFilter = NULL;
42 * Protected constructor
44 * @param $className Name of the class
47 protected function __construct ($className) {
48 // Call parent constructor
49 parent::__construct($className);
53 * Initialize filters. This must be done before you can use them
57 protected function initFilterChains () {
58 // Pre/post-registration filters
59 $this->preRegistrationFilter = ObjectFactory::createObjectByConfiguredName('filter_chain_class');
60 $this->postRegistrationFilter = ObjectFactory::createObjectByConfiguredName('filter_chain_class');
64 * Adds a filter to the pre filter chain
66 * @param $filterInstance An instance of a filter
69 public function addPreFilter (Filterable $filterInstance) {
71 $this->preRegistrationFilter->addFilter($filterInstance);
75 * Adds a filter to the post filter chain
77 * @param $filterInstance An instance of a filter
80 public function addPostFilter (Filterable $filterInstance) {
81 // Add the post filter
82 $this->postRegistrationFilter->addFilter($filterInstance);
86 * Executes all pre filters
90 protected function executePreFilters () {
91 // Execute all pre filters
92 $this->preRegistrationFilter->processFilters($this->getRequestInstance(), $this->getResponseInstance());
96 * Executes all post filters
100 protected function executePostFilters () {
101 // Execute all post filters
102 $this->postRegistrationFilter->processFilters($this->getRequestInstance(), $this->getResponseInstance());