Rewrites:
[core.git] / framework / main / classes / file_directories / output / text / class_FrameworkTextFileOutputPointer.php
index 425c57d96e2062e8e01558def4f2c27b1329f78d..dde389fb12871b1550a828dc2a492fc169f0ff70 100644 (file)
@@ -9,6 +9,7 @@ use CoreFramework\Generic\NullPointerException;
 use CoreFramework\Generic\UnsupportedOperationException;
 
 // Import SPL stuff
+use \InvalidArgumentException;
 use \SplFileInfo;
 
 /**
@@ -50,22 +51,24 @@ class FrameworkTextFileOutputPointer extends BaseFileIo implements OutputPointer
         *
         * @param       $fileInstance   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 mode is empty
         * @throws      FileIoException                 If fopen() returns not a file resource
         * @return      void
         */
        public static final function createFrameworkTextFileOutputPointer (SplFileInfo $fileInstance, $mode) {
                // Some pre-sanity checks...
-               if (is_null($fileInstance)) {
+               if (empty($mode)) {
                        // No filename 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 = $fileInstance->openFile($mode);
+
+               // Is it valid?
                if ((is_null($fileObject)) || ($fileObject === false)) {
                        // Something bad happend
-                       throw new FileIoException ($fileName, self::EXCEPTION_FILE_POINTER_INVALID);
+                       throw new FileIoException($fileInstance, self::EXCEPTION_FILE_POINTER_INVALID);
                } // END - if
 
                // Create new instance