/**
* Creates an instance of this node class
*
- * @param $handlerInstance An instance of a Networkable class
* @return $streamInstance An instance of this node class
*/
- public final static function createRawDataInputStream (Networkable $handlerInstance) {
+ public final static function createRawDataInputStream () {
// Get a new instance
$streamInstance = new RawDataInputStream();
*/
public function streamData ($data) {
// Do we have start and end marker again?
- assert((substr($data, 0, 5) == '[[S]]') && (substr($data, -5, 5) == '[[E]]'));
+ assert($this->ifStartEndMarkerSet($data));
// Remove both
- $data = substr($data, 6 - 5);
+ $data = substr($data, strlen(BaseRawDataHandler::STREAM_START_MARKER), -1 * strlen(BaseRawDataHandler::STREAM_END_MARKER));
// Can it be validated?
if ((strlen($data) % 4) != 0) {
// Length modulo 4 must be zero, else it is an invalid Base64 message
- $this->getHandlerInstance()->setErrorCode(BaseRawDataHandler::SOCKET_ERROR_INVALID_BASE64_MODULO);
+ $handlerInstance->setErrorCode(BaseRawDataHandler::SOCKET_ERROR_INVALID_BASE64_MODULO);
$data = false;
} elseif (!$this->isBase64Encoded($data)) {
// Is not a valid Base64-encoded message
- $this->getHandlerInstance()->setErrorCode(BaseRawDataHandler::SOCKET_ERROR_INVALID_BASE64_MESSAGE);
+ $handlerInstance->setErrorCode(BaseRawDataHandler::SOCKET_ERROR_INVALID_BASE64_MESSAGE);
$data = false;
} else {
// Decode the data with BASE64-encoding