Horde_ActiveSync_Message_Base::_checkEncoding PHP Method

_checkEncoding() protected method

Checks if the data needs to be encoded like e.g., when outputing binary data in-line during ITEMOPERATIONS requests. Concrete classes should override this if needed.
protected _checkEncoding ( mixed $data, string $tag ) : mixed
$data mixed The data to check. A string or stream resource.
$tag string The tag we are outputing.
return mixed The encoded data. A string or stream resource with a filter attached.
    protected function _checkEncoding($data, $tag)
    {
        if (is_resource($data)) {
            stream_filter_register('horde_null', 'Horde_Stream_Filter_Null');
            stream_filter_register('horde_eol', 'Horde_Stream_Filter_Eol');
            $this->_streamFilters[] = stream_filter_prepend($data, 'horde_null', STREAM_FILTER_READ);
            $this->_streamFilters[] = stream_filter_prepend($data, 'horde_eol', STREAM_FILTER_READ);
        }
        return $data;
    }