X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=framework%2Fmain%2Fclasses%2Ffile_directories%2Fclass_BaseFileIo.php;fp=framework%2Fmain%2Fclasses%2Ffile_directories%2Fclass_BaseFileIo.php;h=c0d2aa2524a7c5e70f1f9abd54b22c99bf5705ee;hp=71d6d3ba60498db84cb3216fd63f83a35cdacbd0;hb=1413cff705baa0641da9c39ad0a53d57bb1ae24b;hpb=fc83e6b1ac6fe3a5e09a3e4f8bad20fa2240cae4 diff --git a/framework/main/classes/file_directories/class_BaseFileIo.php b/framework/main/classes/file_directories/class_BaseFileIo.php index 71d6d3ba..c0d2aa25 100644 --- a/framework/main/classes/file_directories/class_BaseFileIo.php +++ b/framework/main/classes/file_directories/class_BaseFileIo.php @@ -58,13 +58,17 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl */ public final function __destruct() { // Is there a resource pointer? Then we have to close the file here! + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: this->fileObject[]=%s - DESTRUCTOR!', gettype($this->getFileObject()))); if (is_object($this->getFileObject())) { // Try to close a file $this->closeFile(); - } // END - if + } // Call the parent destructor parent::__destruct(); + + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-IO: EXIT!'); } /** @@ -76,9 +80,8 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl * @throws LogicException If there is no object being set */ public function closeFile () { - // Debug message + // Validate parameter /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: fileName=%s - CALLED!', $this->getFileObject()->getPathname())); - if (is_null($this->getFileObject())) { // Pointer not initialized throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); @@ -87,14 +90,12 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl throw new LogicException(sprintf('this->fileObject[]=%s is no object', gettype($this->getFileObject()))); } - // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: Closing file %s ...', $this->getFileObject()->getPathname())); - // Close the file pointer by NULL-ing it + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: Closing file %s ...', $this->getFileObject()->getPathname())); $this->resetFileObject(); - // Debug message - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: EXIT!')); + // Trace message + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-IO: EXIT!'); } /** @@ -153,7 +154,7 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl */ public function seek (int $offset, int $whence = SEEK_SET) { // Validate parameter - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: offset=%d,whence=%d - CALLED!', $offset, $whence)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: offset=%d,whence=%d - CALLED!', $offset, $whence)); if ($offset < 0) { // Throw IAE throw new InvalidArgumentException(sprintf('offset=%d is not valid', $offset)); @@ -163,7 +164,7 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl $status = $this->getFileObject()->fseek($offset, $whence); // Return status - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: status=%d - EXIT!', $status)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-IO: status=%d - EXIT!', $status)); return $status; }