]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/file_directories/output/raw/class_FrameworkRawFileOutputPointer.php
Continued:
[core.git] / framework / main / classes / file_directories / output / raw / class_FrameworkRawFileOutputPointer.php
index a63535c69616164b422eb34c3f927c540f98b705..e7453802acc5704342a1bcf2bc0a22fba876d5df 100644 (file)
@@ -1,13 +1,14 @@
 <?php
 // Own namespace
-namespace CoreFramework\Filesystem\Pointer\Output;
+namespace Org\Mxchange\CoreFramework\Filesystem\Pointer\Output;
 
 // Import framework stuff
-use CoreFramework\FileSystem\BaseFileIo;
-use CoreFramework\Filesystem\Pointer\OutputPointer;
-use CoreFramework\Generic\NullPointerException;
+use Org\Mxchange\CoreFramework\FileSystem\BaseFileIo;
+use Org\Mxchange\CoreFramework\Filesystem\Pointer\OutputPointer;
+use Org\Mxchange\CoreFramework\Generic\NullPointerException;
 
 // Import SPL stuff
+use \InvalidArgumentException;
 use \SplFileInfo;
 
 /**
@@ -15,7 +16,7 @@ use \SplFileInfo;
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  *
@@ -49,22 +50,22 @@ class FrameworkRawFileOutputPointer extends BaseFileIo implements OutputPointer
         *
         * @param       $infoInstance   An instance of a SplFileInfo class
         * @param       $mode           The output mode ('w', 'a' are valid)
-        * @throws      FileIsEmptyException    If the provided file name is empty.
+        * @throws      InvalidArgumentException        If parameter mode is empty
         * @throws      FileIoException                 If fopen() returns not a file resource
         * @return      void
         */
        public static final function createFrameworkRawFileOutputPointer (SplFileInfo $infoInstance, $mode) {
                // Some pre-sanity checks...
-               if (is_null($infoInstance)) {
+               if (is_null($mode)) {
                        // No infoInstance given
-                       throw new FileIsEmptyException(NULL, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+                       throw new InvalidArgumentException('Parameter "mode" is empty');
                } // END - if
 
                // Try to open a handler
                $fileObject = $infoInstance->openFile($mode);
                if ((is_null($fileObject)) || ($fileObject === false)) {
                        // Something bad happend
-                       throw new FileIoException ($infoInstance, self::EXCEPTION_FILE_POINTER_INVALID);
+                       throw new FileIoException($infoInstance, self::EXCEPTION_FILE_POINTER_INVALID);
                } // END - if
 
                // Create new instance
@@ -82,10 +83,10 @@ class FrameworkRawFileOutputPointer extends BaseFileIo implements OutputPointer
         *
         * @param       $dataStream             The data stream we shall write to the file
         * @return      mixed                   Number of writes bytes or false on error
-        * @throws      NullPointerException    If the file pointer instance is not set by setPointer()
+        * @throws      NullPointerException    If the file pointer instance is not set by setFileObject()
         * @throws      LogicException  If there is no object being set
         */
-       public function writeToFile ($dataStream) {
+       public function writeToFile (string $dataStream) {
                if (is_null($this->getFileObject())) {
                        // Pointer not initialized
                        throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
@@ -118,7 +119,7 @@ class FrameworkRawFileOutputPointer extends BaseFileIo implements OutputPointer
         * @return      mixed                   Number of writes bytes or false on error
         * @throws      UnsupportedOperationException   If this method is called
         */
-       public function writeAtPosition ($seedPosition, $data) {
+       public function writeAtPosition (int $seedPosition, string $data) {
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }