Code sync from ship-simu code (all class config entries must end with _class!)
[mailer.git] / inc / classes / main / factories / objects / class_ObjectFactory.php
index 024020d6d4782d93e9063712e7715c34da869537..9a2ec9c2d2c9958191c6af7bf2a415dc0e39e255 100644 (file)
@@ -55,14 +55,17 @@ 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);
                }