3 namespace CoreFramework\Registration;
5 // Import framework stuff
6 use CoreFramework\Factory\ObjectFactory;
7 use CoreFramework\Object\BaseFrameworkSystem;
10 * A general registration class.
12 * @author Roland Haeder <webmaster@shipsimu.org>
14 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
15 * @license GNU GPL 3.0 or any newer version
16 * @link http://www.shipsimu.org
18 * This program is free software: you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation, either version 3 of the License, or
21 * (at your option) any later version.
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
28 * You should have received a copy of the GNU General Public License
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
31 class BaseRegistration extends BaseFrameworkSystem {
33 * Pre-registration filter chain
35 private $preRegistrationFilter = NULL;
38 * Pre-registration filter chain
40 private $postRegistrationFilter = NULL;
43 * Protected constructor
45 * @param $className Name of the class
48 protected function __construct ($className) {
49 // Call parent constructor
50 parent::__construct($className);
54 * Initialize filters. This must be done before you can use them
58 protected function initFilterChains () {
59 // Pre/post-registration filters
60 $this->preRegistrationFilter = ObjectFactory::createObjectByConfiguredName('filter_chain_class');
61 $this->postRegistrationFilter = ObjectFactory::createObjectByConfiguredName('filter_chain_class');
65 * Adds a filter to the pre filter chain
67 * @param $filterInstance An instance of a filter
70 public function addPreFilter (Filterable $filterInstance) {
72 $this->preRegistrationFilter->addFilter($filterInstance);
76 * Adds a filter to the post filter chain
78 * @param $filterInstance An instance of a filter
81 public function addPostFilter (Filterable $filterInstance) {
82 // Add the post filter
83 $this->postRegistrationFilter->addFilter($filterInstance);
87 * Executes all pre filters
91 protected function executePreFilters () {
92 // Execute all pre filters
93 $this->preRegistrationFilter->processFilters($this->getRequestInstance(), $this->getResponseInstance());
97 * Executes all post filters
101 protected function executePostFilters () {
102 // Execute all post filters
103 $this->postRegistrationFilter->processFilters($this->getRequestInstance(), $this->getResponseInstance());