Minor refactured
authorRoland Häder <roland@mxchange.org>
Wed, 11 Mar 2009 15:07:54 +0000 (15:07 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 11 Mar 2009 15:07:54 +0000 (15:07 +0000)
inc/classes/main/factories/objects/class_ObjectFactory.php

index 7fe9955..71b7b93 100644 (file)
@@ -49,17 +49,14 @@ class ObjectFactory extends BaseFactory {
         * @throws      EmptyVariableException  If a variable is empty unexpectly
         */
        public final static function createObjectByName ($className, array $args=array()) {
+               // First get an instance of this factory
+               $factoryInstance = new ObjectFactory();
+
                // Is the class name valid and is the class there?
                if (empty($className)) {
-                       // First get an instance of this factory
-                       $factoryInstance = new ObjectFactory();
-
                        // Throw an exception here
                        throw new EmptyVariableException(array($factoryInstance, 'className'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
                } elseif (!class_exists($className)) {
-                       // First get an instance of this factory
-                       $factoryInstance = new ObjectFactory();
-
                        // Then throw an exception
                        throw new ClassNotFoundException(array($factoryInstance, $className), self::EXCEPTION_CLASS_NOT_FOUND);
                }