]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/factories/stacks/class_FileStackFactory.php
Continued:
[core.git] / framework / main / classes / factories / stacks / class_FileStackFactory.php
index 086dd8172a84522a68f6f0ec5c3add2f6a228a58..e4e5e53ad8f9321b12b50e1a7c02950e98ed7d0d 100644 (file)
@@ -9,6 +9,7 @@ use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
 use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
 
 // Import SPL stuff
+use \InvalidArgumentException;
 use \SplFileInfo;
 
 /**
@@ -52,6 +53,16 @@ class FileStackFactory extends BaseFactory {
         * @return      $stackInstance          An instance of a StackableFile class
         */
        public static final function createFileStackInstance (string $prefix, string $stackName) {
+               // Validate parameter
+               //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-STACK-FACTORY: prefix=%s,stackName=%s - CALLED!', $prefix, $stackName));
+               if (empty($prefix)) {
+                       // Throw IAE
+                       throw new InvalidArgumentException('Parameter "prefix" is empty');
+               } elseif (empty($stackName)) {
+                       // Throw it again
+                       throw new InvalidArgumentException('Paramter "stackName" is empty');
+               }
+
                // Construct file stack name
                $fileInfoInstance = new SplFileInfo(sprintf('%s%s/%s.%s',
                        FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('root_base_path'),
@@ -73,6 +84,7 @@ class FileStackFactory extends BaseFactory {
                }
 
                // Return the instance
+               //* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-STACK-FACTORY: stackInstance=%s - EXIT!', $stackInstance->__toString()));
                return $stackInstance;
        }