PHP Interface Kraken\Util\Buffer\BufferInterface

Inheritance: extends ArrayAcces\ArrayAccess, extends Countabl\Countable, extends IteratorAggregat\IteratorAggregate
Show file Open project: kraken-php/framework Interface Usage Examples

Public Methods

Method Description
__toString ( ) : string Return string stored in Buffer.
drain ( ) : string Remove and return all data from the buffer.
insert ( string $string, integer $position ) Insert the string at the given position in the buffer.
isEmpty ( ) : boolean Determine if the buffer is empty.
length ( ) : integer Return current length of the buffer.
peek ( integer $length, integer $offset ) : string Return the given number of characters (at most) from the buffer without removing them from the buffer.
pop ( integer $length ) : string Remove the given number of characters (at most) from the buffer starting at the end.
push ( string $data ) Push the given string onto the end of the buffer.
remove ( integer $length, integer $offset ) : string Remove and return the given number of characters (at most) from the buffer.
replace ( mixed $search, mixed $replace ) : integer Replace all occurences of $search with $replace. See str_replace() function.
search ( string $string, boolean $reverse = false ) : integer | boolean Return the position of the given pattern in the buffer if it exists, or false if it does not.
shift ( integer $length ) : string Remove the given number of characters (at most) from the buffer starting at the beginning.
unshift ( string $data ) Put the given string at the beginning of the buffer.

Method Details

__toString() public method

Return string stored in Buffer.
public __toString ( ) : string
return string

drain() public method

Remove and return all data from the buffer.
public drain ( ) : string
return string

insert() public method

Insert the string at the given position in the buffer.
public insert ( string $string, integer $position )
$string string
$position integer

isEmpty() public method

Determine if the buffer is empty.
public isEmpty ( ) : boolean
return boolean

length() public method

Return current length of the buffer.
public length ( ) : integer
return integer

peek() public method

Return the given number of characters (at most) from the buffer without removing them from the buffer.
public peek ( integer $length, integer $offset ) : string
$length integer
$offset integer
return string

pop() public method

Remove the given number of characters (at most) from the buffer starting at the end.
public pop ( integer $length ) : string
$length integer
return string

push() public method

Push the given string onto the end of the buffer.
public push ( string $data )
$data string

remove() public method

Remove and return the given number of characters (at most) from the buffer.
public remove ( integer $length, integer $offset ) : string
$length integer
$offset integer
return string

replace() public method

Replace all occurences of $search with $replace. See str_replace() function.
public replace ( mixed $search, mixed $replace ) : integer
$search mixed
$replace mixed
return integer

shift() public method

Remove the given number of characters (at most) from the buffer starting at the beginning.
public shift ( integer $length ) : string
$length integer
return string

unshift() public method

Put the given string at the beginning of the buffer.
public unshift ( string $data )
$data string