X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=framework%2Fmain%2Fclasses%2Ffile_directories%2Fbinary%2Fclass_BaseBinaryFile.php;h=c0e7040e87d12e879bee5de35c97f9feb0cbbccd;hp=9ce33ec223d3af94213756d44b65442cef8a3e31;hb=f57dd51863ec9baacba447d76b46d5c709b9b02e;hpb=78a010fef84895720e796842208f01dfb619c332 diff --git a/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php b/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php index 9ce33ec2..c0e7040e 100644 --- a/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php +++ b/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php @@ -1,16 +1,22 @@ * @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.ship-simu.org * @@ -27,7 +33,7 @@ use CoreFramework\Factory\ObjectFactory; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class BaseBinaryFile extends BaseAbstractFile { +abstract class BaseBinaryFile extends BaseAbstractFile { /** * Separator for header data */ @@ -150,7 +156,7 @@ class BaseBinaryFile extends BaseAbstractFile { /* Only for debugging if (isset($this->gaps[0])) { // Output first and last gap - self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] this->gaps[0]=%s,this->gaps[%s]=%s', __METHOD__, __LINE__, print_r($this->gaps[0], TRUE), (count($this->gaps) - 1), print_r($this->gaps[count($this->gaps) - 1], TRUE))); + self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] this->gaps[0]=%s,this->gaps[%s]=%s', __METHOD__, __LINE__, print_r($this->gaps[0], true), (count($this->gaps) - 1), print_r($this->gaps[count($this->gaps) - 1], true))); } // END - if */ @@ -316,7 +322,7 @@ class BaseBinaryFile extends BaseAbstractFile { */ public static function isBlockSeparatorFound ($str) { // Determine it - $isFound = (strpos($str, chr(self::SEPARATOR_ENTRIES)) !== FALSE); + $isFound = (strpos($str, chr(self::SEPARATOR_ENTRIES)) !== false); // Return result return $isFound; @@ -382,12 +388,12 @@ class BaseBinaryFile extends BaseAbstractFile { /** * Initializes this file class * - * @param $fileName Name of this abstract file + * @param $infoInstance An instance of a SplFileInfo class * @return void */ - protected function initFile ($fileName) { + protected function initFile (SplFileInfo $infoInstance) { // Get a file i/o pointer instance - $pointerInstance = ObjectFactory::createObjectByConfiguredName('file_raw_input_output_class', array($fileName)); + $pointerInstance = ObjectFactory::createObjectByConfiguredName('file_raw_input_output_class', array($infoInstance)); // ... and set it here $this->setPointerInstance($pointerInstance); @@ -401,7 +407,7 @@ class BaseBinaryFile extends BaseAbstractFile { * @param $flushHeader Whether to flush the header (default: flush) * @return void */ - public function writeData ($seekPosition, $data, $flushHeader = TRUE) { + public function writeData ($seekPosition, $data, $flushHeader = true) { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] seekPosition=%s,data()=%d - CALLED!', __METHOD__, __LINE__, $seekPosition, strlen($data))); // Write data at given position @@ -414,7 +420,7 @@ class BaseBinaryFile extends BaseAbstractFile { $this->updateSeekPosition(); // Flush the header? - if ($flushHeader === TRUE) { + if ($flushHeader === true) { // Flush header $this->flushFileHeader(); @@ -451,7 +457,7 @@ class BaseBinaryFile extends BaseAbstractFile { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__)); // Default is not initialized - $isInitialized = FALSE; + $isInitialized = false; // Is the file initialized? if ($this->isFileInitialized()) { @@ -469,7 +475,7 @@ class BaseBinaryFile extends BaseAbstractFile { $this->readFileHeader(); // The above method does already check the header - $isInitialized = TRUE; + $isInitialized = true; } // END - if // Return result @@ -485,12 +491,12 @@ class BaseBinaryFile extends BaseAbstractFile { public function isFileInitialized () { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] CALLED!', __METHOD__, __LINE__)); - // Get it from iterator which holds the pointer instance. If FALSE is returned + // Get it from iterator which holds the pointer instance. If false is returned $fileSize = $this->size(); //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] fileSize=%s', __METHOD__, __LINE__, $fileSize)); /* - * The returned file size should not be FALSE or NULL as this means + * The returned file size should not be false or NULL as this means * that the pointer class does not work correctly. */ assert(is_int($fileSize)); @@ -752,7 +758,7 @@ class BaseBinaryFile extends BaseAbstractFile { $dataArray = explode(chr(self::SEPARATOR_ENTRIES), $data); // This array must contain two elements - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('dataArray=' . print_r($dataArray, TRUE)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('dataArray=' . print_r($dataArray, true)); assert(count($dataArray) == 2); // Left part is the actual block, right one the back-buffer data @@ -762,7 +768,7 @@ class BaseBinaryFile extends BaseAbstractFile { /** * Checks wether the current entry is valid (not at the end of the file). - * This method will return TRUE if an emptied (nulled) entry has been found. + * This method will return true if an emptied (nulled) entry has been found. * * @return $isValid Whether the next entry is valid */