X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=framework%2Fmain%2Fclasses%2Ffile_directories%2Finput%2Ftext%2Fclass_FrameworkTextFileInputPointer.php;h=734042760cbd5ba6ee3e19f60795de32f1891f76;hp=0fdd4398c37e314326defec5d958b5db45d8964d;hb=f57dd51863ec9baacba447d76b46d5c709b9b02e;hpb=b9bfbe86c031c9d83c3670602906df191a33ba2a diff --git a/framework/main/classes/file_directories/input/text/class_FrameworkTextFileInputPointer.php b/framework/main/classes/file_directories/input/text/class_FrameworkTextFileInputPointer.php index 0fdd4398..73404276 100644 --- a/framework/main/classes/file_directories/input/text/class_FrameworkTextFileInputPointer.php +++ b/framework/main/classes/file_directories/input/text/class_FrameworkTextFileInputPointer.php @@ -1,23 +1,26 @@ * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2019 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.shipsimu.org * @@ -50,12 +53,12 @@ class FrameworkTextFileInputPointer extends BaseFileIo implements InputPointer { * be verified here. * * @param $fileName The file name we shall pass to fopen() - * @throws FileIsEmptyException If the provided file name is empty. * @throws FileIoException If the file is not reachable * @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); @@ -69,6 +72,11 @@ class FrameworkTextFileInputPointer extends BaseFileIo implements InputPointer { // 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); @@ -78,7 +86,7 @@ class FrameworkTextFileInputPointer extends BaseFileIo implements InputPointer { $pointerInstance = new FrameworkTextFileInputPointer(); // Set file pointer and file name - $pointerInstance->setPointer($fileObject); + $pointerInstance->setFileObject($fileObject); // Return the instance return $pointerInstance; @@ -109,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 - * @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) {