are only for the daemon and not for any frontends.
Signed-off-by: Roland Haeder <roland@mxchange.org>
// CFG: CITY-INIT-STATE-CLASS
$cfg->setConfigEntry('city_init_state_class', 'CityInitState');
+// CFG: CITY-VIRGIN-STATE-CLASS
+$cfg->setConfigEntry('city_virgin_state_class', 'CityVirginState');
+
/******************************************************************************
* HTML client *
******************************************************************************/
// CFG: CITY-DAEMON-WELCOME-TEASER-FILTER
$cfg->setConfigEntry('city_daemon_welcome_teaser_filter', 'CityDaemonWelcomeTeaserFilter');
+// CFG: CITY-DAEMON-BOOTSTRAP-INIT-DAEMON-FILTER
+$cfg->setConfigEntry('city_daemon_bootstrap_init_daemon_filter', 'CityDaemonBootstrapInitDaemonFilter');
+
// CFG: CITY-DAEMON-SHUTDOWN-TASK-HANDLER-FILTER
$cfg->setConfigEntry('city_daemon_shutdown_task_handler_filter', 'CityDaemonShutdownTaskHandlerFilter');
* @param $requestInstance An instance of a Requestable class
* @return void
*/
- function registerCityId (BaseCity $cityInstance, Requestable $requestInstance);
+ function registerCityId (BaseCityDaemon $cityInstance, Requestable $requestInstance);
/**
* Checks whether there is an entry for given city instance
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface CityHelper extends Helper, AddableCriteria {
+ /**
+ * Initializes the city daemon
+ *
+ * @return void
+ */
+ function bootstrapInitCityDaemon ();
+
/**
* Method to "bootstrap" the city. This step does also apply provided
* command-line arguments stored in the request instance. You should now
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A hub-node class for the '???' mode
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2015 City Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class Simulation???City extends BaseCity implements CityHelper, Registerable {
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
- }
-
- /**
- * Creates an instance of this hub-node class
- *
- * @param $requestInstance An instance of a Requestable class
- * @return $nodeInstance An instance of this hub-node class
- */
- public final static function createCity???City (Requestable $requestInstance) {
- // Get a new instance
- $nodeInstance = new City???City();
-
- // Set the request instance
- $nodeInstance->setRequestInstance($requestInstance);
-
- // Return the instance
- return $nodeInstance;
- }
-
- /**
- * Method to "bootstrap" the node. This step does also apply provided
- * command-line arguments stored in the request instance. The regular node
- * should communicate with the bootstrap-nodes at this point.
- *
- * @return void
- * @todo Implement this method
- */
- public function doBootstrapping () {
- // Call generic (parent) bootstrapping method first
- parent::doGenericBootstrapping();
- $this->partialStub('Please implement this method.');
- }
-
- /**
- * Initializes hub-specific queues
- *
- * @return void
- * @todo Implement this method
- */
- public function initQueues () {
- $this->partialStub('Please implement this method.');
- }
-
- /**
- * Add some node-specific filters
- *
- * @return void
- */
- public function addExtraCityFilters () {
- // Add some filters here
- }
-
- /**
- * Adds extra tasks to the given handler for this node
- *
- * @param $handlerInstance An instance of a HandleableTask class
- * @return void
- * @todo 0% done
- */
- public function addExtraTasks (HandleableTask $handlerInstance) {
- $this->partialStub('Please add some tasks or empty this method.');
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-<?php
-/**
- * A general City class
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2015 City Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class BaseCity extends BaseCitySystem implements Updateable, AddableCriteria {
- /**
- * City types
- */
- const CITY_TYPE_TESTING = 'testing';
-
- /**
- * Whether this City is active (default: FALSE)
- */
- private $isActive = FALSE;
-
- /**
- * Protected constructor
- *
- * @param $className Name of the class
- * @return void
- */
- protected function __construct ($className) {
- // Call parent constructor
- parent::__construct($className);
-
- // Get a wrapper instance
- $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('city_info_db_wrapper_class');
-
- // Set it here
- $this->setWrapperInstance($wrapperInstance);
-
- // Get a crypto instance
- $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
-
- // Set it here
- $this->setCryptoInstance($cryptoInstance);
-
- // Init state which sets the state to 'init'
- $this->initState();
- }
-
- /**
- * Initializes the City's state which sets it to 'init'
- *
- * @return void
- */
- private function initState() {
- // Get the state factory and create the initial state.
- CityStateFactory::createCityStateInstanceByName('init', $this);
- }
-
- /**
- * Outputs the console teaser. This should only be executed on startup or
- * full restarts. This method generates some space around the teaser.
- *
- * @return void
- */
- public function outputConsoleTeaser () {
- // Get the app instance (for shortening our code)
- $app = $this->getApplicationInstance();
-
- // Output all lines
- self::createDebugInstance(__CLASS__)->debugOutput(' ');
- self::createDebugInstance(__CLASS__)->debugOutput($app->getAppName() . ' v' . $app->getAppVersion() . ' - ' . $this->getRequestInstance()->getRequestElement('mode') . ' daemon starting');
- self::createDebugInstance(__CLASS__)->debugOutput('Copyright (c) 2015 City Developer Team');
- self::createDebugInstance(__CLASS__)->debugOutput(' ');
- self::createDebugInstance(__CLASS__)->debugOutput('This program comes with ABSOLUTELY NO WARRANTY; for details see docs/COPYING.');
- self::createDebugInstance(__CLASS__)->debugOutput('This is free software, and you are welcome to redistribute it under certain');
- self::createDebugInstance(__CLASS__)->debugOutput('conditions; see docs/COPYING for details.');
- self::createDebugInstance(__CLASS__)->debugOutput(' ');
- }
-
- /**
- * Adds City data elements to a given dataset instance
- *
- * @param $criteriaInstance An instance of a storeable criteria
- * @param $requestInstance An instance of a Requestable class
- * @return void
- */
- public function addElementsToDataSet (StoreableCriteria $criteriaInstance, Requestable $requestInstance = NULL) {
- // Make sure the request instance is set as it is not optional.
- assert($requestInstance instanceof Requestable);
-
- // Add City number and type
- $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_ID , 1);
- $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_MODE, $requestInstance->getRequestElement('mode'));
-
- // Add the City id
- $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_ID, $this->getCityId());
-
- // Add the session id if acquired
- if ($this->getSessionId() != '') {
- $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_SESSION_ID, $this->getSessionId());
- } // END - if
-
- // Add the private key if acquired
- if ($this->getPrivateKey() != '') {
- $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_PRIVATE_KEY, base64_encode($this->getPrivateKey()));
- $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_PRIVATE_KEY_HASH, $this->getPrivateKeyHash());
- } // END - if
-
- // Add own external and internal addresses as UNLs
- $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_INTERNAL_UNL, CityTools::determineOwnInternalAddress());
- $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_EXTERNAL_UNL, CityTools::determineOwnExternalAddress());
- }
-
- /**
- * Updates a given field with new value
- *
- * @param $fieldName Field to update
- * @param $fieldValue New value to store
- * @return void
- * @throws DatabaseUpdateSupportException If this class does not support database updates
- * @todo Try to make this method more generic so we can move it in BaseFrameworkSystem
- */
- public function updateDatabaseField ($fieldName, $fieldValue) {
- // Unfinished
- $this->partialStub('Unfinished!');
- return;
-
- // Get a critieria instance
- $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
-
- // Add search criteria
- $searchInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName());
- $searchInstance->setLimit(1);
-
- // Now get another criteria
- $updateInstance = ObjectFactory::createObjectByConfiguredName('update_criteria_class');
-
- // Add criteria entry which we shall update
- $updateInstance->addCriteria($fieldName, $fieldValue);
-
- // Add the search criteria for searching for the right entry
- $updateInstance->setSearchInstance($searchInstance);
-
- // Set wrapper class name
- $updateInstance->setWrapperConfigEntry('user_db_wrapper_class');
-
- // Remember the update in database result
- $this->getResultInstance()->add2UpdateQueue($updateInstance);
- }
-
- /**
- * Activates the City by doing some final preparation and setting
- * $CityIsActive to TRUE.
- *
- * @param $requestInstance A Requestable class
- * @param $responseInstance A Responseable class
- * @return void
- */
- public function activateCity (Requestable $requestInstance, Responseable $responseInstance) {
- // Get the controller here
- $controllerInstance = Registry::getRegistry()->getInstance('controller');
-
- // Run all filters for the City activation
- $controllerInstance->executeActivationFilters($requestInstance, $responseInstance);
-
- // Make sure the city's state is 'virigin'
- assert($this->getStateInstance()->validateCityStateIsVirgin() === TRUE);
-
- // ----------------------- Last step from here ------------------------
- // Activate the City. This is ALWAYS the last step in this method
- /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CITY[' . __METHOD__ . ':' . __LINE__ . ']: state=' . $this->getStateInstance()->__toString());
- $this->getStateInstance()->citySimulationIsActivated();
- // ---------------------- Last step until here ------------------------
- }
-
- /**
- * Getter for isActive attribute
- *
- * @return $isActive Whether the City is active
- */
- public final function isCityActive () {
- return $this->isActive;
- }
-
- /**
- * Enables (default) or disables isActive flag
- *
- * @param $isActive Whether the City is active
- * @return void
- */
- public final function enableIsActive ($isActive = TRUE) {
- $this->isActive = (bool) $isActive;
- }
-
- /**
- * Updates/refreshes City data (e.g. status).
- *
- * @return void
- * @todo Find more to do here
- */
- public function updateCityData () {
- // Set some dummy configuration entries, e.g. city_status
- $this->getConfigInstance()->setConfigEntry('city_status', $this->getStateInstance()->getStateName());
- }
-
- /**
- * Adds all required elements from given array into data set instance
- *
- * @param $dataSetInstance An instance of a StoreableCriteria class
- * @param $CityData An array with valid City data
- * @return void
- */
- public function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $cityData) {
- // Add all data the array provides
- foreach (CityInformationDatabaseWrapper::getAllElements() as $element) {
- // Is the element there?
- if (isset($cityData[$element])) {
- // Add it
- $dataSetInstance->addCriteria($element, $cityData[$element]);
- } else {
- // Output warning message
- /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CITY[' . __METHOD__ . ':' . __LINE__ . ']: addArrayToDataSet(): Element ' . $element . ' not found in CityData array.');
- }
- } // END - foreac
- }
-}
-
-// [EOF]
-?>
+++ /dev/null
-Deny from all
+++ /dev/null
-<?php
-/**
- * A city class for testing purposes
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2015 City Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class SimulationTestingCity extends BaseCity implements CityHelper, Registerable {
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
- }
-
- /**
- * Creates an instance of this hub-node class
- *
- * @param $requestInstance An instance of a Requestable class
- * @return $nodeInstance An instance of this hub-node class
- */
- public static final function createSimulationTestingCity (Requestable $requestInstance) {
- // Get a new instance
- $nodeInstance = new SimulationTestingCity();
-
- // Set the request instance
- $nodeInstance->setRequestInstance($requestInstance);
-
- // Return the instance
- return $nodeInstance;
- }
-
- /**
- * Method to "bootstrap" the node. This step does also apply provided
- * command-line arguments stored in the request instance. The regular node
- * should communicate with the bootstrap-nodes at this point.
- *
- * @return void
- * @todo Implement this method
- */
- public function doBootstrapping () {
- $this->partialStub();
- }
-
- /**
- * Add some node-specific filters
- *
- * @return void
- */
- public function addExtraCityFilters () {
- // Get the application instance from registry
- $applicationInstance = Registry::getRegistry()->getInstance('app');
-
- // Get the controller from the application
- $controllerInstance = $applicationInstance->getControllerInstance();
-
- // Foo task
- // @TODO $controllerInstance->addActivationFilter(ObjectFactory::createObjectByConfiguredName('city_foo_task_filter'));
-
- // @TODO Add some filters here
- $this->partialStub('Add some filters here.');
- }
-
- /**
- * Adds extra tasks to the given handler for this node
- *
- * @param $handlerInstance An instance of a HandleableTask class
- * @return void
- * @todo 0% done
- */
- public function addExtraTasks (HandleableTask $handlerInstance) {
- $this->partialStub('Please add some tasks or empty this method.');
- }
-}
-
-// [EOF]
-?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A hub-node class for the '???' mode
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015 City Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class Simulation???CityDaemon extends BaseCity implements CityHelper, Registerable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this hub-node class
+ *
+ * @param $requestInstance An instance of a Requestable class
+ * @return $nodeInstance An instance of this hub-node class
+ */
+ public final static function createSimulation???CityDaemon (Requestable $requestInstance) {
+ // Get a new instance
+ $nodeInstance = new Simulation???CityDaemon();
+
+ // Set the request instance
+ $nodeInstance->setRequestInstance($requestInstance);
+
+ // Return the instance
+ return $nodeInstance;
+ }
+
+ /**
+ * Method to "bootstrap" the node. This step does also apply provided
+ * command-line arguments stored in the request instance. The regular node
+ * should communicate with the bootstrap-nodes at this point.
+ *
+ * @return void
+ * @todo Implement this method
+ */
+ public function doBootstrapping () {
+ // Call generic (parent) bootstrapping method first
+ parent::doGenericBootstrapping();
+ $this->partialStub('Please implement this method.');
+ }
+
+ /**
+ * Initializes hub-specific queues
+ *
+ * @return void
+ * @todo Implement this method
+ */
+ public function initQueues () {
+ $this->partialStub('Please implement this method.');
+ }
+
+ /**
+ * Add some node-specific filters
+ *
+ * @return void
+ */
+ public function addExtraCityFilters () {
+ // Add some filters here
+ }
+
+ /**
+ * Adds extra tasks to the given handler for this node
+ *
+ * @param $handlerInstance An instance of a HandleableTask class
+ * @return void
+ * @todo 0% done
+ */
+ public function addExtraTasks (HandleableTask $handlerInstance) {
+ $this->partialStub('Please add some tasks or empty this method.');
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A general City class
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015 City Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class BaseCityDaemon extends BaseCitySystem implements Updateable, AddableCriteria {
+ /**
+ * City types
+ */
+ const CITY_TYPE_TESTING = 'testing';
+
+ /**
+ * Whether this City is active (default: FALSE)
+ */
+ private $isActive = FALSE;
+
+ /**
+ * Protected constructor
+ *
+ * @param $className Name of the class
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+
+ // Get a wrapper instance
+ $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('city_info_db_wrapper_class');
+
+ // Set it here
+ $this->setWrapperInstance($wrapperInstance);
+
+ // Get a crypto instance
+ $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
+
+ // Set it here
+ $this->setCryptoInstance($cryptoInstance);
+
+ // Add own instance to registry
+ Registry::getRegistry()->addInstance('city', $this);
+
+ // Init state which sets the state to 'init'
+ $this->initState();
+ }
+
+ /**
+ * Initializes the City's state which sets it to 'init'
+ *
+ * @return void
+ */
+ private function initState() {
+ // Get the state factory and create the initial state.
+ CityStateFactory::createCityStateInstanceByName('init');
+ }
+
+ /**
+ * Outputs the console teaser. This should only be executed on startup or
+ * full restarts. This method generates some space around the teaser.
+ *
+ * @return void
+ */
+ public function outputConsoleTeaser () {
+ // Get the app instance (for shortening our code)
+ $app = $this->getApplicationInstance();
+
+ // Output all lines
+ self::createDebugInstance(__CLASS__)->debugOutput(' ');
+ self::createDebugInstance(__CLASS__)->debugOutput($app->getAppName() . ' v' . $app->getAppVersion() . ' - ' . $this->getRequestInstance()->getRequestElement('mode') . ' daemon starting');
+ self::createDebugInstance(__CLASS__)->debugOutput('Copyright (c) 2015 City Developer Team');
+ self::createDebugInstance(__CLASS__)->debugOutput(' ');
+ self::createDebugInstance(__CLASS__)->debugOutput('This program comes with ABSOLUTELY NO WARRANTY; for details see docs/COPYING.');
+ self::createDebugInstance(__CLASS__)->debugOutput('This is free software, and you are welcome to redistribute it under certain');
+ self::createDebugInstance(__CLASS__)->debugOutput('conditions; see docs/COPYING for details.');
+ self::createDebugInstance(__CLASS__)->debugOutput(' ');
+ }
+
+ /**
+ * Adds City data elements to a given dataset instance
+ *
+ * @param $criteriaInstance An instance of a storeable criteria
+ * @param $requestInstance An instance of a Requestable class
+ * @return void
+ */
+ public function addElementsToDataSet (StoreableCriteria $criteriaInstance, Requestable $requestInstance = NULL) {
+ // Make sure the request instance is set as it is not optional.
+ assert($requestInstance instanceof Requestable);
+
+ // Add City number and type
+ $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_ID , 1);
+ $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_MODE, $requestInstance->getRequestElement('mode'));
+
+ // Add the City id
+ $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_CITY_ID, $this->getCityId());
+
+ // Add the session id if acquired
+ if ($this->getSessionId() != '') {
+ $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_SESSION_ID, $this->getSessionId());
+ } // END - if
+
+ // Add the private key if acquired
+ if ($this->getPrivateKey() != '') {
+ $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_PRIVATE_KEY, base64_encode($this->getPrivateKey()));
+ $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_PRIVATE_KEY_HASH, $this->getPrivateKeyHash());
+ } // END - if
+
+ // Add own external and internal addresses as UNLs
+ $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_INTERNAL_UNL, CityTools::determineOwnInternalAddress());
+ $criteriaInstance->addCriteria(CityInformationDatabaseWrapper::DB_COLUMN_EXTERNAL_UNL, CityTools::determineOwnExternalAddress());
+ }
+
+ /**
+ * Updates a given field with new value
+ *
+ * @param $fieldName Field to update
+ * @param $fieldValue New value to store
+ * @return void
+ * @throws DatabaseUpdateSupportException If this class does not support database updates
+ * @todo Try to make this method more generic so we can move it in BaseFrameworkSystem
+ */
+ public function updateDatabaseField ($fieldName, $fieldValue) {
+ // Unfinished
+ $this->partialStub('Unfinished!');
+ return;
+
+ // Get a critieria instance
+ $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+
+ // Add search criteria
+ $searchInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName());
+ $searchInstance->setLimit(1);
+
+ // Now get another criteria
+ $updateInstance = ObjectFactory::createObjectByConfiguredName('update_criteria_class');
+
+ // Add criteria entry which we shall update
+ $updateInstance->addCriteria($fieldName, $fieldValue);
+
+ // Add the search criteria for searching for the right entry
+ $updateInstance->setSearchInstance($searchInstance);
+
+ // Set wrapper class name
+ $updateInstance->setWrapperConfigEntry('user_db_wrapper_class');
+
+ // Remember the update in database result
+ $this->getResultInstance()->add2UpdateQueue($updateInstance);
+ }
+
+ /**
+ * Activates the City by doing some final preparation and setting
+ * $CityIsActive to TRUE.
+ *
+ * @param $requestInstance A Requestable class
+ * @param $responseInstance A Responseable class
+ * @return void
+ */
+ public function activateCity (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get the controller here
+ $controllerInstance = Registry::getRegistry()->getInstance('controller');
+
+ // Run all filters for the City activation
+ $controllerInstance->executeActivationFilters($requestInstance, $responseInstance);
+
+ // Make sure the city's state is 'virigin'
+ $this->getStateInstance()->validateCityStateIsVirgin();
+
+ // ----------------------- Last step from here ------------------------
+ // Activate the City. This is ALWAYS the last step in this method
+ /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CITY[' . __METHOD__ . ':' . __LINE__ . ']: state=' . $this->getStateInstance()->__toString());
+ $this->getStateInstance()->citySimulationIsActivated();
+ // ---------------------- Last step until here ------------------------
+ }
+
+ /**
+ * Getter for isActive attribute
+ *
+ * @return $isActive Whether the City is active
+ */
+ public final function isCityActive () {
+ return $this->isActive;
+ }
+
+ /**
+ * Enables (default) or disables isActive flag
+ *
+ * @param $isActive Whether the City is active
+ * @return void
+ */
+ public final function enableIsActive ($isActive = TRUE) {
+ $this->isActive = (bool) $isActive;
+ }
+
+ /**
+ * Updates/refreshes City data (e.g. status).
+ *
+ * @return void
+ * @todo Find more to do here
+ */
+ public function updateCityData () {
+ // Set some dummy configuration entries, e.g. city_status
+ $this->getConfigInstance()->setConfigEntry('city_status', $this->getStateInstance()->getStateName());
+ }
+
+ /**
+ * Adds all required elements from given array into data set instance
+ *
+ * @param $dataSetInstance An instance of a StoreableCriteria class
+ * @param $CityData An array with valid City data
+ * @return void
+ */
+ public function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $cityData) {
+ // Add all data the array provides
+ foreach (CityInformationDatabaseWrapper::getAllElements() as $element) {
+ // Is the element there?
+ if (isset($cityData[$element])) {
+ // Add it
+ $dataSetInstance->addCriteria($element, $cityData[$element]);
+ } else {
+ // Output warning message
+ /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CITY[' . __METHOD__ . ':' . __LINE__ . ']: addArrayToDataSet(): Element ' . $element . ' not found in CityData array.');
+ }
+ } // END - foreac
+ }
+
+ /**
+ * Initializes the city daemon
+ *
+ * @return void
+ */
+ public function bootstrapInitCityDaemon () {
+ $this->partialStub('Please add something here.');
+
+ // Daemon has been fully initialized, so change state to 'virgin'
+ $this->getStateInstance()->daemonHasInitialized();
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A city class for testing purposes
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015 City Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class SimulationTestingCityDaemon extends BaseCityDaemon implements CityHelper, Registerable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this hub-node class
+ *
+ * @param $requestInstance An instance of a Requestable class
+ * @return $nodeInstance An instance of this hub-node class
+ */
+ public static final function createSimulationTestingCityDaemon (Requestable $requestInstance) {
+ // Get a new instance
+ $nodeInstance = new SimulationTestingCityDaemon();
+
+ // Set the request instance
+ $nodeInstance->setRequestInstance($requestInstance);
+
+ // Return the instance
+ return $nodeInstance;
+ }
+
+ /**
+ * Method to "bootstrap" the city simulation. This step does also apply
+ * provided command-line arguments stored in the request instance.
+ *
+ * @return void
+ * @todo Implement this method
+ */
+ public function doBootstrapping () {
+ $this->partialStub();
+ }
+
+ /**
+ * Add some node-specific filters
+ *
+ * @return void
+ */
+ public function addExtraCityFilters () {
+ // Get the application instance from registry
+ $applicationInstance = Registry::getRegistry()->getInstance('app');
+
+ // Get the controller from the application
+ $controllerInstance = $applicationInstance->getControllerInstance();
+
+ // Foo task
+ // @TODO $controllerInstance->addActivationFilter(ObjectFactory::createObjectByConfiguredName('city_foo_task_filter'));
+
+ // @TODO Add some filters here
+ $this->partialStub('Add some filters here.');
+ }
+
+ /**
+ * Adds extra tasks to the given handler for this node
+ *
+ * @param $handlerInstance An instance of a HandleableTask class
+ * @return void
+ * @todo 0% done
+ */
+ public function addExtraTasks (HandleableTask $handlerInstance) {
+ $this->partialStub('Please add some tasks or empty this method.');
+ }
+}
+
+// [EOF]
+?>
self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: Bootstrap finished.');
// Get city instance
- $cityInstance = CityObjectFactory::createCityInstance();
+ $cityInstance = CityDaemonObjectFactory::createCityDaemonInstance();
// Add some city-specific filters, e.g. announcement
$cityInstance->addExtraCityFilters();
$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_welcome_teaser_filter'));
// Add bootstrap filters
- //$controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_bootstrap_generate_cityid_filter'));
+ $controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_bootstrap_init_daemon_filter'));
// Add city activation filters
$controllerInstance->addActivationFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_activation_task_handler_initializer_filter'));
* @param $requestInstance An instance of a Requestable class
* @return void
*/
- public function registerCityId (BaseCity $cityInstance, Requestable $requestInstance) {
+ public function registerCityId (BaseCityDaemon $cityInstance, Requestable $requestInstance) {
// Get a dataset instance
$dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_CITY_INFORMATION));
--- /dev/null
+<?php
+/**
+ * A factory class for cities
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015 City Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class CityDaemonObjectFactory extends ObjectFactory {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Returns a singleton (registry-based) CityHelper instance
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return $cityInstance An instance of a CityHelper class
+ * @throws FactoryRequiredParameterException If not all parameters are set and no instance 'city' is set.
+ */
+ public static final function createCityDaemonInstance (Requestable $requestInstance = NULL, Responseable $responseInstance = NULL) {
+ // Get new factory instance
+ $factoryInstance = new CityDaemonObjectFactory();
+
+ // If there is no handler?
+ if (Registry::getRegistry()->instanceExists('city')) {
+ // Get handler from registry
+ $cityInstance = Registry::getRegistry()->getInstance('city');
+ } elseif (($requestInstance instanceof Requestable) && ($responseInstance instanceof Responseable)) {
+ // The default city-mode is from our configuration
+ $cityMode = $factoryInstance->getConfigInstance()->getConfigEntry('city_default_mode');
+
+ // Is the city 'mode' parameter set?
+ if ($requestInstance->isRequestElementSet('mode')) {
+ // Then use this which overrides the config entry temporarily
+ $cityMode = $requestInstance->getRequestElement('mode');
+ } else {
+ // Set it for easier re-usage
+ $requestInstance->setRequestElement('mode', $cityMode);
+ }
+
+ // Now convert the city-mode in a class name
+ $className = 'Simulation' . $factoryInstance->convertToClassName($cityMode) . 'CityDaemon';
+
+ // Get the city instance
+ $cityInstance = ObjectFactory::createObjectByName($className, array($requestInstance));
+
+ // Get a registry
+ $applicationInstance = Registry::getRegistry()->getInstance('app');
+
+ // Set the app instance
+ $cityInstance->setApplicationInstance($applicationInstance);
+
+ // Add city-specific filters
+ $cityInstance->addExtraFilters($applicationInstance->getControllerInstance(), $responseInstance);
+ } else {
+ // Throw an exception here
+ throw new FactoryRequiredParameterException($factoryInstance, self::EXCEPTION_FACTORY_REQUIRE_PARAMETER);
+ }
+
+ // Return the instance
+ return $cityInstance;
+ }
+}
+
+// [EOF]
+?>
+++ /dev/null
-<?php
-/**
- * A factory class for cities
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2015 City Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class CityObjectFactory extends ObjectFactory {
- /**
- * Protected constructor
- *
- * @return void
- */
- protected function __construct () {
- // Call parent constructor
- parent::__construct(__CLASS__);
- }
-
- /**
- * Returns a singleton (registry-based) CityHelper instance
- *
- * @param $requestInstance An instance of a class with an Requestable interface
- * @param $responseInstance An instance of a class with an Responseable interface
- * @return $cityInstance An instance of a CityHelper class
- * @throws FactoryRequiredParameterException If not all parameters are set and no instance 'city' is set.
- */
- public static final function createCityInstance (Requestable $requestInstance = NULL, Responseable $responseInstance = NULL) {
- // Get new factory instance
- $factoryInstance = new CityObjectFactory();
-
- // If there is no handler?
- if (Registry::getRegistry()->instanceExists('city')) {
- // Get handler from registry
- $cityInstance = Registry::getRegistry()->getInstance('city');
- } elseif (($requestInstance instanceof Requestable) && ($responseInstance instanceof Responseable)) {
- // The default city-mode is from our configuration
- $cityMode = $factoryInstance->getConfigInstance()->getConfigEntry('city_default_mode');
-
- // Is the city 'mode' parameter set?
- if ($requestInstance->isRequestElementSet('mode')) {
- // Then use this which overrides the config entry temporarily
- $cityMode = $requestInstance->getRequestElement('mode');
- } else {
- // Set it for easier re-usage
- $requestInstance->setRequestElement('mode', $cityMode);
- }
-
- // Now convert the city-mode in a class name
- $className = 'Simulation' . $factoryInstance->convertToClassName($cityMode) . 'City';
-
- // Get the city instance
- $cityInstance = ObjectFactory::createObjectByName($className, array($requestInstance));
-
- // Get a registry
- $applicationInstance = Registry::getRegistry()->getInstance('app');
-
- // Set the app instance
- $cityInstance->setApplicationInstance($applicationInstance);
-
- // Add city-specific filters
- $cityInstance->addExtraFilters($applicationInstance->getControllerInstance(), $responseInstance);
-
- // Add it to the registry
- Registry::getRegistry()->addInstance('city', $cityInstance);
- } else {
- // Throw an exception here
- throw new FactoryRequiredParameterException($factoryInstance, self::EXCEPTION_FACTORY_REQUIRE_PARAMETER);
- }
-
- // Return the instance
- return $cityInstance;
- }
-}
-
-// [EOF]
-?>
* given city instance.
*
* @param $stateName Name of the state
- * @param $cityInstance A CityHelper class instance
* @return $stateInstance A Stateable class instance
*/
- public static final function createCityStateInstanceByName ($stateName, CityHelper $cityInstance) {
+ public static final function createCityStateInstanceByName ($stateName) {
// Then construct the class' configuraton entry
$className = 'city_' . $stateName . '_state_class';
// Get a class from that configuration entry
- $stateInstance = self::createObjectByConfiguredName($className, array($cityInstance));
+ $stateInstance = self::createObjectByConfiguredName($className);
+
+ // Get city instance
+ $cityInstance = Registry::getRegistry()->getInstance('city');
// Debug message
self::createDebugInstance(__CLASS__)->debugOutput('CITY-STATE-FACTORY[' . __METHOD__ . ':' . __LINE__ . ']: City state has changed from ' . $cityInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.');
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A bootstrap ??? filter for daemon
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015 City Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class CityDaemonBootstrap???Filter extends BaseCityFilter implements Filterable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @return $filterInstance An instance of this filter class
+ */
+ public final static function createCityDaemonBootstrap???Filter () {
+ // Get a new instance
+ $filterInstance = new CityDaemonBootstrap???Filter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ * @throws FilterChainException If $cityInstance is null (no NullPointerException here)
+ * @todo 0% done
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get city instance
+ $cityInstance = Registry::getRegistry()->getInstance('city');
+
+ // Now do something
+ $this->partialStub('Please implement this step.');
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A bootstrap InitDaemon filter for daemon
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015 City Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class CityDaemonBootstrapInitDaemonFilter extends BaseCityFilter implements Filterable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @return $filterInstance An instance of this filter class
+ */
+ public final static function createCityDaemonBootstrapInitDaemonFilter () {
+ // Get a new instance
+ $filterInstance = new CityDaemonBootstrapInitDaemonFilter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ * @throws FilterChainException If $cityInstance is null (no NullPointerException here)
+ * @todo 0% done
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get city instance
+ $cityInstance = Registry::getRegistry()->getInstance('city');
+
+ // Now bootstrap the daemon
+ $cityInstance->bootstrapInitCityDaemon();
+ }
+}
+
+// [EOF]
+?>
// Try to instance it by using a factory
try {
// Get an instance
- $cityInstance = CityObjectFactory::createCityInstance($requestInstance, $responseInstance);
+ $cityInstance = CityDaemonObjectFactory::createCityDaemonInstance($requestInstance, $responseInstance);
} catch (ClassNotFoundException $e) {
// This exception means, the city mode is invalid.
// @TODO Can we rewrite this to app_exit() ?
$this->debugBackTrace('[' . __METHOD__ . ':' . __LINE__ . ']: city mode ' . $cityMode . ' is invalid.');
}
- // Set the city instance in registry
- Registry::getRegistry()->addInstance('city', $cityInstance);
- //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE-INIT-FILTER[' . __METHOD__ . ':' . __LINE__ . ']: City ' . $cityMode . ' has been added to registry.');
+ // Debug message
+ /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE-INIT-FILTER[' . __METHOD__ . ':' . __LINE__ . ']: City daemon ' . $cityMode . ' has been added to registry.');
}
}
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
// Get city instance
- $cityInstance = CityObjectFactory::createCityInstance();
+ $cityInstance = CityDaemonObjectFactory::createCityDaemonInstance();
// Now output the teaser
$cityInstance->outputConsoleTeaser();
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
// Get city instance
- $cityInstance = CityObjectFactory::createCityInstance();
+ $cityInstance = CityDaemonObjectFactory::createCityDaemonInstance();
// Shutdown the city. This should be the last line
$cityInstance->doShutdown();
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
// Get city instance
- $cityInstance = CityObjectFactory::createCityInstance();
+ $cityInstance = CityDaemonObjectFactory::createCityDaemonInstance();
// Get a new task handler instance
$handlerInstance = ObjectFactory::createObjectByConfiguredName('task_handler_class');
/**
* Creates an instance of this class
*
- * @param $cityInstance An instance of a CityHelper class
* @return $stateInstance An instance of a Stateable class
*/
- public static final function createCityActiveState (CityHelper $cityInstance) {
+ public static final function createCityActiveState () {
// Get new instance
$stateInstance = new CityActiveState();
// Get city instance and set 'active' flag
- CityObjectFactory::createCityInstance()->enableIsActive();
+ CityDaemonObjectFactory::createCityDaemonInstance()->enableIsActive();
// Return the prepared instance
return $stateInstance;
/**
* Creates an instance of this class
*
- * @param $cityInstance An instance of a CityHelper class
* @return $stateInstance An instance of a Stateable class
*/
- public final static function createCity???State (CityHelper $cityInstance) {
+ public final static function createCity???State () {
// Get new instance
$stateInstance = new City???State();
- // Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CITY-STATE: Has changed from ' . $cityInstance->getPrintableState() . ' to ' . $stateInstance->getStateName() . '.');
-
// Return the prepared instance
return $stateInstance;
}
/**
* Creates an instance of this class
*
- * @param $cityInstance An instance of a CityHelper class
* @return $stateInstance An instance of a Stateable class
*/
- public static final function createCityInitState (CityHelper $cityInstance) {
+ public static final function createCityInitState () {
// Get new instance
$stateInstance = new CityInitState();
// Return the prepared instance
return $stateInstance;
}
+
+ /**
+ * Executes the state with given Executor instance
+ *
+ * @param $executorInstance An instance of a Executor class
+ * @return void
+ */
+ public function executeState (Executor $executorInstance) {
+ // Initialize the daemon
+ $executorInstance->initializeDaemon($this);
+ }
+
+ /**
+ * The daemon has been fully initialized so change the state to 'virgin'.
+ *
+ * @return void
+ */
+ public function daemonHasInitialized () {
+ // Change the state now to 'virgin'
+ CityStateFactory::createCityStateInstanceByName('virgin');
+ }
}
// [EOF]
/**
* Creates an instance of this class
*
- * @param $cityInstance An instance of a CityHelper class
* @return $stateInstance An instance of a Stateable class
*/
- public static final function createCityVirginState (CityHelper $cityInstance) {
+ public static final function createCityVirginState () {
// Get new instance
$stateInstance = new CityVirginState();
-Subproject commit c33ae28f2865cdcfb330dbbc6e8159b1d17b9ce0
+Subproject commit 1c6401b0efc57aaf1735d05c260be92499cc6e32