const FILE_IO_DATA_BLOCK_ID = '@data';
/**
- * Seperator #1
+ * Separator #1
*/
const FILE_IO_CHUNKER = ':';
/**
- * Seperator #2
+ * Separator #2
*/
- const FILE_IO_SEPERATOR = '^';
+ const FILE_IO_SEPARATOR = '^';
/**
* Protected constructor
// Write a header information for validation purposes
$fileInstance->writeToFile(sprintf("%s%s%s%s%s%s%s%s%s\n",
self::FILE_IO_FILE_HEADER_ID,
- self::FILE_IO_SEPERATOR,
+ self::FILE_IO_SEPARATOR,
$dataArray[0],
self::FILE_IO_CHUNKER,
time(),
// Save it to the stream
$fileInstance->writeToFile(sprintf("%s%s%s%s%s\n",
self::FILE_IO_DATA_BLOCK_ID,
- self::FILE_IO_SEPERATOR,
+ self::FILE_IO_SEPARATOR,
$line,
self::FILE_IO_CHUNKER,
md5($line)
$fileInstance->closeFile();
// Convert it into an array
- $inputBuffer = explode("\n", $inputBuffer);
+ $inputBuffer = explode(chr(10), $inputBuffer);
// Now process the read lines and verify it's content
foreach ($inputBuffer as $rawLine) {
// Analyze this line
if (substr($rawLine, 0, 5) == self::FILE_IO_FILE_HEADER_ID) {
// Header found, so let's extract it
- $header = explode(self::FILE_IO_SEPERATOR, $rawLine);
+ $header = explode(self::FILE_IO_SEPARATOR, $rawLine);
$header = trim($header[1]);
// Now we must convert it again into an array
} // END - if
} elseif (substr($rawLine, 0, 5) == self::FILE_IO_DATA_BLOCK_ID) {
// Is a data line!
- $data = explode(self::FILE_IO_SEPERATOR, $rawLine);
+ $data = explode(self::FILE_IO_SEPARATOR, $rawLine);
$data = $data[1];
// First element is the data, second the MD5 checksum
$readData .= $data[0];
} else {
// Other raw lines than header/data tagged lines and re-add the new-line char
- $readData .= $rawLine . "\n";
+ $readData .= $rawLine . chr(10);
}
} // END - foreach