]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/factories/objects/class_ObjectFactory.php
Renamed Registry -> GenericRegistry to make it clear that this registry does
[core.git] / framework / main / classes / factories / objects / class_ObjectFactory.php
index ebde62499338fe56c3bfe666bd45da5c4955cf60..f06a70a16b6a82a4ff32738853114b89ffdbb4b9 100644 (file)
@@ -1,11 +1,10 @@
 <?php
 // Own namespace
-namespace CoreFramework\Factory;
+namespace Org\Mxchange\CoreFramework\Factory;
 
 // Import framework stuff
-use CoreFramework\Configuration\FrameworkConfiguration;
-use CoreFramework\Generic\EmptyVariableException;
-use CoreFramework\Loader\NoClassException;
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Loader\NoClassException;
 
 // Import SPL stuff
 use \InvalidArgumentException;
@@ -53,8 +52,7 @@ class ObjectFactory extends BaseFactory {
         * @param       $args                           Arguments in an indexed array
         * @return      $objectInstance         An instance of the requested object
         * @throws      NoClassException        If the requested class was not found
-        * @throws      EmptyVariableException  If a variable is empty unexpectly
-        * @throws      InvalidArgumentException        If class name is not following naming-convention
+        * @throws      InvalidArgumentException        If className is empty or the name not following naming-convention
         */
        public static final function createObjectByName ($className, array $args = array()) {
                // First get an instance of this factory
@@ -66,13 +64,13 @@ class ObjectFactory extends BaseFactory {
                // Is the class name valid and is the class there?
                if (empty($className)) {
                        // Throw an exception here
-                       throw new EmptyVariableException(array($factoryInstance, 'className'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+                       throw new InvalidArgumentException('Parameter "className" is empty');
                } elseif (!class_exists($className)) {
                        // Then throw an exception
                        throw new NoClassException(array($factoryInstance, $className), self::EXCEPTION_CLASS_NOT_FOUND);
                } elseif (count($classNameParts) < 3) {
                        // Namespaces are missing
-                       throw new InvalidArgumentException(sprintf('Class name "%s" is not conform to naming-convention: Project\Package[\SubPackage...]\SomeFooBar', $className));
+                       throw new InvalidArgumentException(sprintf('Class name "%s" is not conform to naming-convention: Tld\Domain\Project\Package[\SubPackage...]\SomeFooBar', $className));
                }
 
                // Create method name
@@ -97,7 +95,7 @@ class ObjectFactory extends BaseFactory {
         */
        public static final function createObjectByConfiguredName ($configEntry, array $args = array()) {
                // Read the configuration entry
-               $className = FrameworkConfiguration::getSelfInstance()->getConfigEntry($configEntry);
+               $className = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($configEntry);
 
                // Send this to the other factory...
                $objectInstance = self::createObjectByName($className, $args);