]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/file_directories/input/text/class_FrameworkTextFileInputPointer.php
Continued:
[core.git] / framework / main / classes / file_directories / input / text / class_FrameworkTextFileInputPointer.php
index 50c21f6c5b4b0e0f0b27cec871b0cd911663c21b..00706310c813857b180e6bb686f89ed3198f57db 100644 (file)
@@ -1,16 +1,19 @@
 <?php
 // Own namespace
 <?php
 // Own namespace
-namespace CoreFramework\Filesystem\Pointer\Input;
+namespace Org\Mxchange\CoreFramework\Filesystem\Pointer\Input;
 
 // Import framework stuff
 
 // Import framework stuff
-use CoreFramework\Bootstrap\FrameworkBootstrap;
-use CoreFramework\FileSystem\BaseFileIo;
-use CoreFramework\Filesystem\FileNotFoundException;
-use CoreFramework\FileSystem\FileReadProtectedException;
-use CoreFramework\Filesystem\Pointer\InputPointer;
-use CoreFramework\Generic\NullPointerException;
-use CoreFramework\Generic\UnsupportedOperationException;
-use CoreFramework\Object\BaseFrameworkSystem;
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\FileSystem\BaseFileIo;
+use Org\Mxchange\CoreFramework\Filesystem\FileNotFoundException;
+use Org\Mxchange\CoreFramework\FileSystem\FileReadProtectedException;
+use Org\Mxchange\CoreFramework\Filesystem\Pointer\InputPointer;
+use Org\Mxchange\CoreFramework\Generic\NullPointerException;
+use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
+use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+
+// Import SPL stuff
+use \SplFileInfo;
 
 /**
  * A class for reading text files
 
 /**
  * A class for reading text files
@@ -54,7 +57,8 @@ class FrameworkTextFileInputPointer extends BaseFileIo implements InputPointer {
         * @throws      FileReadProtectedException      If the file cannot be read from
         * @return      void
         */
         * @throws      FileReadProtectedException      If the file cannot be read from
         * @return      void
         */
-       public static final function createFrameworkTextFileInputPointer ($infoInstance) {
+       public static final function createFrameworkTextFileInputPointer (SplFileInfo $infoInstance) {
+               // Check parameter
                if (!FrameworkBootstrap::isReachableFilePath($infoInstance)) {
                        // File cannot be reached
                        throw new FileIoException($infoInstance, self::EXCEPTION_FILE_NOT_REACHABLE);
                if (!FrameworkBootstrap::isReachableFilePath($infoInstance)) {
                        // File cannot be reached
                        throw new FileIoException($infoInstance, self::EXCEPTION_FILE_NOT_REACHABLE);
@@ -68,6 +72,11 @@ class FrameworkTextFileInputPointer extends BaseFileIo implements InputPointer {
 
                // Try to open a handler
                $fileObject = $infoInstance->openFile('r');
 
                // Try to open a handler
                $fileObject = $infoInstance->openFile('r');
+
+               // Debug message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TEXT-FILE-INPUT: fileObject[]=' . gettype($fileObject));
+
+               // Is it valid?
                if ((is_null($fileObject)) || ($fileObject === false)) {
                        // Something bad happend
                        throw new FileIoException($infoInstance, self::EXCEPTION_FILE_POINTER_INVALID);
                if ((is_null($fileObject)) || ($fileObject === false)) {
                        // Something bad happend
                        throw new FileIoException($infoInstance, self::EXCEPTION_FILE_POINTER_INVALID);
@@ -77,7 +86,7 @@ class FrameworkTextFileInputPointer extends BaseFileIo implements InputPointer {
                $pointerInstance = new FrameworkTextFileInputPointer();
 
                // Set file pointer and file name
                $pointerInstance = new FrameworkTextFileInputPointer();
 
                // Set file pointer and file name
-               $pointerInstance->setPointer($fileObject);
+               $pointerInstance->setFileObject($fileObject);
 
                // Return the instance
                return $pointerInstance;
 
                // Return the instance
                return $pointerInstance;
@@ -108,7 +117,7 @@ class FrameworkTextFileInputPointer extends BaseFileIo implements InputPointer {
         *
         * @param       $bytes  Amount of bytes to read or whole line (only text files)
         * @return      $data   Data read from file
         *
         * @param       $bytes  Amount of bytes to read or whole line (only text files)
         * @return      $data   Data read from file
-        * @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      InvalidResourceException        If there is no object being set
         */
        public function read ($bytes = NULL) {
         * @throws      InvalidResourceException        If there is no object being set
         */
        public function read ($bytes = NULL) {