]> git.mxchange.org Git - core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Mon, 7 Dec 2020 07:55:19 +0000 (08:55 +0100)
committerRoland Häder <roland@mxchange.org>
Mon, 7 Dec 2020 07:55:19 +0000 (08:55 +0100)
- 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 <roland@mxchange.org>
framework/main/classes/factories/client/class_ClientFactory.php
framework/main/classes/factories/database/class_DatabaseFrontendFactory.php
framework/main/classes/factories/index/class_FileStackIndexFactory.php
framework/main/classes/factories/login/class_LoginFactory.php
framework/main/classes/factories/registry/class_SocketRegistryFactory.php
framework/main/classes/factories/stacks/class_FileStackFactory.php
framework/main/classes/factories/user/class_UserFactory.php
framework/main/classes/factories/xml/class_XmlTemplateEngineFactory.php

index 079905a4d5a92a684ce4164346ba2f2b2b7a6a91..4bfb42ac441500ec6add415371cff83ee046cf56 100644 (file)
@@ -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 <http://www.gnu.org/licenses/>.
  */
-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);
index e772c3158c85ebe0995666b6d4131c50fa91e351..0f4a06e6d747287281ba9a7f2bae9741967d1e9f 100644 (file)
@@ -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 <http://www.gnu.org/licenses/>.
  */
-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);
index 92b843a5b6d5acb12b47f5cf3b36e7b09eadeec5..f2945d5548a3934ede6375862b8698ad44652679 100644 (file)
@@ -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 <http://www.gnu.org/licenses/>.
  */
-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);
index c6976f15bca26cca1c2716f7c8fb6910b31036d7..82d3bf04a88f369ab9c5efe1b51ca1ecf76053a7 100644 (file)
@@ -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 <http://www.gnu.org/licenses/>.
  */
-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);
index 0750a5aa6253c7a704f47c6e237a3dc0809eb2d9..20314b13a46e675c94a784a69cde243a52831858 100644 (file)
@@ -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 <http://www.gnu.org/licenses/>.
  */
-class SocketRegistryFactory extends ObjectFactory {
+class SocketRegistryFactory extends BaseFactory {
        /**
         * Protected constructor
         *
index ddd9600166bee951d44bb864879b6c19e1baecd6..0debdd451381695df3ab5c74466f6cbc2c1d09a7 100644 (file)
@@ -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 <http://www.gnu.org/licenses/>.
  */
-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);
index ddf42d2a807c9533eea5665b04740b3fe980af98..e927f44320b807c3bcffecc6d00fae99f99a2952 100644 (file)
@@ -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 <http://www.gnu.org/licenses/>.
  */
-class UserFactory extends ObjectFactory {
+class UserFactory extends BaseFactory {
        /**
         * Protected constructor
         *
index 484bb56e81bc7a86f91c522b58e4057588da8ce9..8e44c3982e682e88a2045529538c0229f4bb7447 100644 (file)
@@ -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 <http://www.gnu.org/licenses/>.
  */
-class XmlTemplateEngineFactory extends ObjectFactory {
+class XmlTemplateEngineFactory extends BaseFactory {
        /**
         * Protected constructor
         *