]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/stacker/file/fifo/class_FiFoFileStack.php
Continued:
[core.git] / framework / main / classes / stacker / file / fifo / class_FiFoFileStack.php
index 3b1c23799590023816f389c78637a8350884e9bb..3c291361d5ee1e1052c54bd75676bd8f10395c72 100644 (file)
@@ -4,6 +4,8 @@ namespace Org\Mxchange\CoreFramework\Stack\File;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Filesystem\Block\CalculatableBlock;
+use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
+use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware;
 use Org\Mxchange\CoreFramework\Registry\Registerable;
 use Org\Mxchange\CoreFramework\Stack\File\BaseFileStack;
 use Org\Mxchange\CoreFramework\Stack\File\StackableFile;
@@ -18,7 +20,7 @@ use \SplFileInfo;
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2021 Core Developer Team
+ * @copyright  Copyright (c) 2023 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
  *
@@ -59,14 +61,14 @@ class FiFoFileStack extends BaseFileStack implements StackableFile, Calculatable
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FIFO-FILE-STACK: fileInfoInstance[%s]=%s,type=%s - CALLED!', get_class($fileInfoInstance), $fileInfoInstance, $type));
                if (empty($type)) {
                        // No empty type
-                       throw new InvalidArgumentException('Parameter "type" is empty');
+                       throw new InvalidArgumentException('Parameter "type" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                }
 
                // Get new instance
                $stackInstance = new FiFoFileStack();
 
                // Init this stack
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FIFO-FILE-STACK: Calling stackInstance->initFileStack([%s]=%s,%s) ...', get_class($fileInfoInstance), $fileInfoInstance, $type));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FIFO-FILE-STACK: Invoking stackInstance->initFileStack([%s]=%s,%s) ...', get_class($fileInfoInstance), $fileInfoInstance, $type));
                $stackInstance->initFileStack($fileInfoInstance, $type);
 
                // Return the prepared instance
@@ -81,21 +83,21 @@ class FiFoFileStack extends BaseFileStack implements StackableFile, Calculatable
         * @param       $value                  Value to push on it
         * @return      void
         * @throws      InvalidArgumentException        If a parameter is invalid
-        * @throws      StackerFullException    If the stack is full
+        * @throws      BadMethodCallException  If the stack is full
         */
        public function pushNamed (string $stackerName, $value) {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FIFO-FILE-STACK: stackerName=%s,value[]=%s - CALLED!', $stackerName, gettype($value)));
                if (empty($stackerName)) {
                        // No empty stack name
-                       throw new InvalidArgumentException('Parameter "stackerName" is empty');
+                       throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                } elseif (is_object($value) || is_resource($value)) {
                        // Those types for $value are not allowed
                        throw new InvalidArgumentException(sprintf('value[]=%s is not valid', gettype($value)));
                }
 
                // Call the protected method
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FIFO-FILE-STACK: Calling parent::addValueToStack(%s,%s) ...', $stackerName, gettype($value)));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FIFO-FILE-STACK: Invoking parent::addValueToStack(%s,%s) ...', $stackerName, gettype($value)));
                parent::addValueToStack($stackerName, $value);
 
                // Trace message
@@ -116,7 +118,7 @@ class FiFoFileStack extends BaseFileStack implements StackableFile, Calculatable
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FIFO-FILE-STACK: stackerName=%s - CALLED!', $stackerName));
                if (empty($stackerName)) {
                        // No empty stack name
-                       throw new InvalidArgumentException('Parameter "stackerName" is empty');
+                       throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                }
 
                // Get the value
@@ -145,7 +147,7 @@ class FiFoFileStack extends BaseFileStack implements StackableFile, Calculatable
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FIFO-FILE-STACK: stackerName=%s - CALLED!', $stackerName));
                if (empty($stackerName)) {
                        // No empty stack name
-                       throw new InvalidArgumentException('Parameter "stackerName" is empty');
+                       throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                }
 
                // Call the protected method
@@ -174,7 +176,7 @@ class FiFoFileStack extends BaseFileStack implements StackableFile, Calculatable
                }
 
                // @TODO Unfinished method or invoke inner iterator's method?
-               $this->partialStub('seekPosition=' . $seekPosition);
+               DebugMiddleware::getSelfInstance()->partialStub('seekPosition=' . $seekPosition);
 
                // Trace message
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FIFO-FILE-STACK: EXIT!');