Class ByteStream
Used to represent bytestream objects Since strings in php are equivalent to
bytestreams (1 character=1 byte),this functions as a simple wrapper around
primitive php string with added sanity checks and helpers
Methods summary
public
|
#
__construct( string|NGS\ByteStream |resource $value = '' )
Creates a new instance from native string or stream resource
Creates a new instance from native string or stream resource
Parameters
- $value
string|NGS\ByteStream |resource $value Primitive string, instance of ByteStream or a stream resource
Throws
|
public static
NGS\ByteStream
|
#
fromBase64( mixed $value )
Factory method accepts base64 encoded string or other ByteStream instance
Factory method accepts base64 encoded string or other ByteStream instance
Returns
|
public static
NGS\ByteStream
|
#
fromBinary( mixed $value )
Factory method accepts raw string or other ByteStream instance
Factory method accepts raw string or other ByteStream instance
Returns
|
public static
array
|
#
toArray( array $items, boolean $allowNullValues = false )
Converts all elements in array to \NGS\Bytestream instances String elements
must be base64 encoded
Converts all elements in array to \NGS\Bytestream instances String elements
must be base64 encoded
Parameters
- $items
array $items Source array, each element must be a valid argument for Bytestream
constructor
- $allowNullValues
boolean $allowNullValues
Returns
array Resulting Bytestream array
Throws
|
public
|
#
__get( mixed $name )
Magic getter for value property
Magic getter for value property
|
public
string
|
#
__toString( )
Gets bytestream value encoded in base64
Gets bytestream value encoded in base64
Returns
string Base64 encoded bytestream
|
public
string
|
#
toBase64( )
Gets bytestream value encoded in base64
Gets bytestream value encoded in base64
Returns
string Base64 encoded bytestream
|
public
boolean
|
#
equals( NGS\ByteStream $other )
Checks for equality against another ByteStream instance
Checks for equality against another ByteStream instance
Parameters
- $other
Bytestream $other Instance to compare with
Returns
boolean
|
public
integer
|
#
size( )
Gets bytestream size (number of bytes)
Gets bytestream size (number of bytes)
Returns
integer Bytestream size
|
public
string
|
#
getValue( )
Gets raw value
Returns
string Bytestream value
|
Properties summary
protected
mixed
|
$value
|
|
|
Magic properties summary
public
string
|
$value
|
#
Returns raw bytestream value as string
Returns raw bytestream value as string
|