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