// 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 ------------------------
}
$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.');
+ /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CITY[' . __METHOD__ . ':' . __LINE__ . ']: addArrayToDataSet(): Element ' . $element . ' not found in CityData array.');
}
} // END - foreac
}
* it is every other state.
*
* @return void
- * @throws InvalidStateException If the state is not 'active'
+ * @throws UnexpectedStateException If the state is not 'active'
*/
public function validateCityStateIsActive () {
// Just compare it...
if (!$this instanceof CityActiveState) {
// Throw the exception
- throw new InvalidStateException($this, self::EXCEPTION_INVALID_STATE);
+ throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
+ } // END - if
+ }
+
+ /**
+ * Validates whether the state is 'virgin' or throws an exception if
+ * it is every other state.
+ *
+ * @return void
+ * @throws UnexpectedStateException If the state is not 'virgin'
+ */
+ public function validateCityStateIsVirgin () {
+ // Just compare it...
+ if (!$this instanceof CityVirginState) {
+ // Throw the exception
+ throw new UnexpectedStateException($this, self::EXCEPTION_INVALID_STATE);
} // END - if
}
}
}
/**
- * Change the state to 'active' when the city simulation has initialized all
+ * Change the state to 'active' when the city daemon has initialized all
* tasks, queues, etc.
*
* @return void
*/
- public function citySimulationIsActivated () {
+ public function cityIsActivated () {
// Create the new state instance
CityStateFactory::createCityStateInstanceByName('active');
}
-
}
// [EOF]
-Subproject commit cc0e0b439900fd1ffb882f9150f37dd3eb8d301d
+Subproject commit c33ae28f2865cdcfb330dbbc6e8159b1d17b9ce0