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