]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/factories/index/class_FileStackIndexFactory.php
Continued:
[core.git] / framework / main / classes / factories / index / class_FileStackIndexFactory.php
index b24f28847d78e7c150f6f57d4f822d5efcf83ffa..51de21d65febb40f8fc7928044e1bc255f504e7b 100644 (file)
@@ -7,6 +7,7 @@ use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 
 // Import SPL stuff
+use \InvalidArgumentException;
 use \SplFileInfo;
 
 /**
@@ -47,10 +48,14 @@ class FileStackIndexFactory extends ObjectFactory {
         *
         * @param       $infoInstance   An instance of a SplFileInfo class
         * @return      $indexInstance  An instance of a IndexableStack class
+        * @throws      InvalidArgumentException        If a parameter is invalid
         */
        public static final function createFileStackIndexInstance (SplFileInfo $infoInstance, string $type) {
                // If there is no handler?
-               if (GenericRegistry::getRegistry()->instanceExists($type . '_index')) {
+               if (empty($type)) {
+                       // Throw IAE
+                       throw new InvalidArgumentException('Parameter "type" is empty');
+               } elseif (GenericRegistry::getRegistry()->instanceExists($type . '_index')) {
                        // Get handler from registry
                        $indexInstance = GenericRegistry::getRegistry()->getInstance($type . '_index');
                } else {