From: Roland Häder Date: Mon, 7 Dec 2020 07:55:19 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5e0cb5baf0c78f49644b96da6bd7a2821590526d;p=core.git Continued: - ObjectFactoty is now final, extend BaseFactory instead and if you still need to invoke methods, just do it the normal way - this allows better unit-testing Signed-off-by: Roland Häder --- diff --git a/framework/main/classes/factories/client/class_ClientFactory.php b/framework/main/classes/factories/client/class_ClientFactory.php index 079905a4..4bfb42ac 100644 --- a/framework/main/classes/factories/client/class_ClientFactory.php +++ b/framework/main/classes/factories/client/class_ClientFactory.php @@ -3,6 +3,7 @@ namespace Org\Mxchange\CoreFramework\Factory\Client; // Import framework stuff +use Org\Mxchange\CoreFramework\Factory\BaseFactory; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; /** @@ -27,7 +28,7 @@ use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class ClientFactory extends ObjectFactory { +class ClientFactory extends BaseFactory { /** * Protected constructor * @@ -62,7 +63,7 @@ class ClientFactory extends ObjectFactory { $clientInstance->setSocketResource($socketResource); } else { // Generate object instance - $clientInstance = self::createObjectByConfiguredName($registryKey, array($socketResource)); + $clientInstance = ObjectFactory::createObjectByConfiguredName($registryKey, array($socketResource)); // Set it in registry for later re-use GenericRegistry::getRegistry()->addInstance($registryKey, $clientInstance); diff --git a/framework/main/classes/factories/database/class_DatabaseFrontendFactory.php b/framework/main/classes/factories/database/class_DatabaseFrontendFactory.php index e772c315..0f4a06e6 100644 --- a/framework/main/classes/factories/database/class_DatabaseFrontendFactory.php +++ b/framework/main/classes/factories/database/class_DatabaseFrontendFactory.php @@ -3,6 +3,7 @@ namespace Org\Mxchange\CoreFramework\Factory\Database\Frontend; // Import framework stuff +use Org\Mxchange\CoreFramework\Factory\BaseFactory; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; @@ -28,7 +29,7 @@ use Org\Mxchange\CoreFramework\Registry\GenericRegistry; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class DatabaseFrontendFactory extends ObjectFactory { +class DatabaseFrontendFactory extends BaseFactory { /** * Protected constructor * @@ -56,7 +57,7 @@ class DatabaseFrontendFactory extends ObjectFactory { $frontendInstance = $registryInstance->getInstance($frontendName); } else { // Get the registry instance - $frontendInstance = self::createObjectByConfiguredName($frontendName); + $frontendInstance = ObjectFactory::createObjectByConfiguredName($frontendName); // Set the instance in registry for further use $registryInstance->addInstance($frontendName, $frontendInstance); diff --git a/framework/main/classes/factories/index/class_FileStackIndexFactory.php b/framework/main/classes/factories/index/class_FileStackIndexFactory.php index 92b843a5..f2945d55 100644 --- a/framework/main/classes/factories/index/class_FileStackIndexFactory.php +++ b/framework/main/classes/factories/index/class_FileStackIndexFactory.php @@ -3,6 +3,7 @@ namespace Org\Mxchange\CoreFramework\Factory\Stack\File; // Import framework stuff +use Org\Mxchange\CoreFramework\Factory\BaseFactory; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; @@ -32,7 +33,7 @@ use \SplFileInfo; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class FileStackIndexFactory extends ObjectFactory { +class FileStackIndexFactory extends BaseFactory { /** * Protected constructor * @@ -60,7 +61,7 @@ class FileStackIndexFactory extends ObjectFactory { $indexInstance = GenericRegistry::getRegistry()->getInstance($type . '_index'); } else { // Get the handler instance - $indexInstance = self::createObjectByConfiguredName($type . '_file_stack_index_class', array($infoInstance)); + $indexInstance = ObjectFactory::createObjectByConfiguredName($type . '_file_stack_index_class', array($infoInstance)); // Add it to the registry GenericRegistry::getRegistry()->addInstance($type . '_index', $indexInstance); diff --git a/framework/main/classes/factories/login/class_LoginFactory.php b/framework/main/classes/factories/login/class_LoginFactory.php index c6976f15..82d3bf04 100644 --- a/framework/main/classes/factories/login/class_LoginFactory.php +++ b/framework/main/classes/factories/login/class_LoginFactory.php @@ -3,6 +3,7 @@ namespace Org\Mxchange\CoreFramework\Factory\Login; // Import framework stuff +use Org\Mxchange\CoreFramework\Factory\BaseFactory; use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; @@ -29,7 +30,7 @@ use Org\Mxchange\CoreFramework\Request\Requestable; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class LoginFactory extends ObjectFactory { +class LoginFactory extends BaseFactory { /** * Protected constructor * @@ -58,13 +59,13 @@ class LoginFactory extends ObjectFactory { // Probe on member instance try { // Try to instance member login class - $loginInstance = self::createObjectByConfiguredName('user_login_class'); + $loginInstance = ObjectFactory::createObjectByConfiguredName('user_login_class'); // Test login $loginInstance->testLogin($requestInstance); } catch (UnexpectedGuestAccountException $e) { // Then try guest login - $loginInstance = self::createObjectByConfiguredName('guest_login_class'); + $loginInstance = ObjectFactory::createObjectByConfiguredName('guest_login_class'); // Test login again $loginInstance->testLogin($requestInstance); diff --git a/framework/main/classes/factories/registry/class_SocketRegistryFactory.php b/framework/main/classes/factories/registry/class_SocketRegistryFactory.php index 0750a5aa..20314b13 100644 --- a/framework/main/classes/factories/registry/class_SocketRegistryFactory.php +++ b/framework/main/classes/factories/registry/class_SocketRegistryFactory.php @@ -3,7 +3,7 @@ namespace Org\Mxchange\CoreFramework\Factory\Registry\Socket; // Import framework stuff -use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; +use Org\Mxchange\CoreFramework\Factory\BaseFactory; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; /** @@ -28,7 +28,7 @@ use Org\Mxchange\CoreFramework\Registry\GenericRegistry; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class SocketRegistryFactory extends ObjectFactory { +class SocketRegistryFactory extends BaseFactory { /** * Protected constructor * diff --git a/framework/main/classes/factories/stacks/class_FileStackFactory.php b/framework/main/classes/factories/stacks/class_FileStackFactory.php index ddd96001..0debdd45 100644 --- a/framework/main/classes/factories/stacks/class_FileStackFactory.php +++ b/framework/main/classes/factories/stacks/class_FileStackFactory.php @@ -4,7 +4,7 @@ namespace Org\Mxchange\CoreFramework\Factory\Stack; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; -use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; +use Org\Mxchange\CoreFramework\Factory\BaseFactory; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; // Import SPL stuff @@ -32,7 +32,7 @@ use \SplFileInfo; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class FileStackFactory extends ObjectFactory { +class FileStackFactory extends BaseFactory { /** * Protected constructor * @@ -65,7 +65,7 @@ class FileStackFactory extends ObjectFactory { $stackInstance = GenericRegistry::getRegistry()->getInstance($stackName . '_stack'); } else { // Get the handler instance - $stackInstance = self::createObjectByConfiguredName($prefix . '_' . $stackName . '_stack_class', array($fileInfoInstance, $prefix . '_' . $stackName)); + $stackInstance = ObjectFactory::createObjectByConfiguredName($prefix . '_' . $stackName . '_stack_class', array($fileInfoInstance, $prefix . '_' . $stackName)); // Add it to the registry GenericRegistry::getRegistry()->addInstance($stackName . '_stack', $stackInstance); diff --git a/framework/main/classes/factories/user/class_UserFactory.php b/framework/main/classes/factories/user/class_UserFactory.php index ddf42d2a..e927f443 100644 --- a/framework/main/classes/factories/user/class_UserFactory.php +++ b/framework/main/classes/factories/user/class_UserFactory.php @@ -4,7 +4,7 @@ namespace Org\Mxchange\CoreFramework\Factory\User; // Import framework stuff use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap; -use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; +use Org\Mxchange\CoreFramework\Factory\BaseFactory; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; use Org\Mxchange\CoreFramework\Request\Requestable; @@ -30,7 +30,7 @@ use Org\Mxchange\CoreFramework\Request\Requestable; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class UserFactory extends ObjectFactory { +class UserFactory extends BaseFactory { /** * Protected constructor * diff --git a/framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php b/framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php index 484bb56e..8e44c398 100644 --- a/framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php +++ b/framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php @@ -3,7 +3,7 @@ namespace Org\Mxchange\CoreFramework\Factory\Template; // Import framework stuff -use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory; +use Org\Mxchange\CoreFramework\Factory\BaseFactory; use Org\Mxchange\CoreFramework\Registry\GenericRegistry; /** @@ -30,7 +30,7 @@ use Org\Mxchange\CoreFramework\Registry\GenericRegistry; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class XmlTemplateEngineFactory extends ObjectFactory { +class XmlTemplateEngineFactory extends BaseFactory { /** * Protected constructor *