+ /**
+ * Initializes the bank instance
+ *
+ * @return $bankInstance A bank instance wether just created or from registry
+ */
+ protected function initBankInstance () {
+ // Init instance
+ $bankInstance = null;
+
+ try {
+ // Get a money bank instance from registry
+ $bankInstance = Registry::getRegistry()->getInstance('money_bank');
+ } catch (NullPointerException $e) {
+ // Instance not found in registry
+ // @TODO We should log this exception later
+ }
+
+ // Is it there?
+ if (is_null($bankInstance)) {
+ // Then create a new one
+ $bankInstance = ObjectFactory::createObjectByConfiguredName('bank_class', array($this));
+
+ // Store it in registry
+ Registry::getRegistry()->addInstance('money_bank', $bankInstance);
+ } // END - if
+
+ // Return the instance
+ return $bankInstance;
+ }
+
+ /**
+ * Initializes the government instance
+ *
+ * @return $governmentInstance A government instance
+ */
+ protected function initGovernmentInstance () {
+ // Init instance
+ $governmentInstance = null;
+
+ try {
+ // First get a government instance from registry
+ $governmentInstance = Registry::getRegistry()->getInstance('government');
+ } catch (NullPointerException $e) {
+ // Instance not found in registry
+ // @TODO We should log this exception later
+ }
+
+ // Is it there?
+ if (is_null($governmentInstance)) {
+ // Then create a new one
+ $governmentInstance = ObjectFactory::createObjectByConfiguredName('government_class', array($this));
+
+ // Store it in registry
+ Registry::getRegistry()->addInstance('government', $governmentInstance);
+ } // END - if
+
+ // Return the prepared instance
+ return $governmentInstance;
+ }
+