From: Roland Haeder Date: Mon, 27 Jun 2016 18:35:23 +0000 (+0200) Subject: Continued a bit: (yes, very long no activity, I'm a dad now of a half-pinay) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1a3fcb11e2010b2a35bcd8c60aaa30f75f0ba860;p=city.git Continued a bit: (yes, very long no activity, I'm a dad now of a half-pinay) - Uni* LF is now default end-of-line character - added some assertions on manager instances Signed-off-by: Roland Haeder --- diff --git a/.gitattributes b/.gitattributes index dfe0770..17cdcd5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,2 @@ -# Auto detect text files and perform LF normalization -* text=auto +# Use Linux/Uni* line-feed for new lines (prevents converting) +* text=lf diff --git a/application/city/classes/commands/html/class_CityHtmlCityMapCommand.php b/application/city/classes/commands/html/class_CityHtmlCityMapCommand.php index 53f66c8..f787793 100644 --- a/application/city/classes/commands/html/class_CityHtmlCityMapCommand.php +++ b/application/city/classes/commands/html/class_CityHtmlCityMapCommand.php @@ -60,6 +60,9 @@ class CityHtmlCityMapCommand extends BaseCommand implements Commandable { // First get a UserRegistration instance $managerInstance = ManagerFactory::createManagerByType('city'); + // Make sure the instance is valid + assert($managerInstance instanceof ManageableCity); + // First set request and response instance $managerInstance->setRequestInstance($requestInstance); $managerInstance->setResponseInstance($responseInstance); diff --git a/application/city/classes/database/frontend/city/class_CityInformationDatabaseWrapper.php b/application/city/classes/database/frontend/city/class_CityInformationDatabaseWrapper.php index 6624b56..3bf431d 100644 --- a/application/city/classes/database/frontend/city/class_CityInformationDatabaseWrapper.php +++ b/application/city/classes/database/frontend/city/class_CityInformationDatabaseWrapper.php @@ -144,6 +144,9 @@ class CityInformationDatabaseWrapper extends BaseDatabaseWrapper implements City // Get city manager instance $managerInstance = ManagerFactory::createManagerByType('city'); + // Make sure the manager instance is valid + assert($managerInstance instanceof ManageableCity); + // Set result instance $managerInstance->setResultInstance($resultInstance); @@ -177,6 +180,9 @@ class CityInformationDatabaseWrapper extends BaseDatabaseWrapper implements City // Get manger instance $managerInstance = ManagerFactory::createManagerByType('city'); + // Make sure the instance is valid + assert($managerInstance instanceof ManageableCity); + // Set result instance $managerInstance->setResultInstance($resultInstance); diff --git a/application/city/classes/database/frontend/region/class_RegionInformationDatabaseWrapper.php b/application/city/classes/database/frontend/region/class_RegionInformationDatabaseWrapper.php index 5dd0765..53b2e85 100644 --- a/application/city/classes/database/frontend/region/class_RegionInformationDatabaseWrapper.php +++ b/application/city/classes/database/frontend/region/class_RegionInformationDatabaseWrapper.php @@ -92,6 +92,9 @@ class RegionInformationDatabaseWrapper extends BaseDatabaseWrapper implements Re // Get region manager instance $managerInstance = ManagerFactory::createManagerByType('region'); + // Make sure the instance is valid + assert($managerInstance instanceof ManageableRegion); + // Set result instance $managerInstance->setResultInstance($resultInstance); @@ -126,6 +129,9 @@ class RegionInformationDatabaseWrapper extends BaseDatabaseWrapper implements Re // Get manger instance $managerInstance = ManagerFactory::createManagerByType('region'); + // Make sure the instance is valid + assert($managerInstance instanceof ManageableRegion); + // Set result instance $managerInstance->setResultInstance($resultInstance); diff --git a/application/city/classes/filter/verifier/class_CityNameVerifierFilter.php b/application/city/classes/filter/verifier/class_CityNameVerifierFilter.php index af90201..fe24113 100644 --- a/application/city/classes/filter/verifier/class_CityNameVerifierFilter.php +++ b/application/city/classes/filter/verifier/class_CityNameVerifierFilter.php @@ -100,6 +100,9 @@ class CityNameVerifierFilter extends BaseFilter implements Filterable { // Get a new instance $managerInstance = ManagerFactory::createManagerByType('city'); + // Make sure the instance is valid + assert($managerInstance instanceof ManageableCity); + // Does the city name exist? $alreadyTaken = ($managerInstance->ifCityNameExists($cityName)); diff --git a/application/city/classes/manager/city/class_CityManager.php b/application/city/classes/manager/city/class_CityManager.php index e8bb312..9b8748f 100644 --- a/application/city/classes/manager/city/class_CityManager.php +++ b/application/city/classes/manager/city/class_CityManager.php @@ -98,7 +98,8 @@ class CityManager extends BaseManager implements ManageableCity { // Get region manager $managerInstance = ManagerFactory::createManagerByType('region'); - // There should be no region created + // The manager instance should be valid and no region should be created + assert($managerInstance instanceof ManageableRegion); assert(!$managerInstance->ifUserHasCreatedRegion()); // Create first region and get back whole result