Erebot  latest
A modular IRC bot for PHP 5.3+
Erebot\Interfaces\TextWrapper Interface Reference

Interface for a text wrapper that makes it easier to manipulate text. More...

+ Inheritance diagram for Erebot\Interfaces\TextWrapper:

Public Member Functions

 __toString ()
 
 countTokens ($separator= ' ')
 
 getTokens ($start, $length=0, $separator= ' ')
 
- Public Member Functions inherited from Countable
 count ()
 
- Public Member Functions inherited from ArrayAccess
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
- Public Member Functions inherited from Iterator
 current ()
 
 key ()
 
 next ()
 
 rewind ()
 
 valid ()
 

Detailed Description

Interface for a text wrapper that makes it easier to manipulate text.

Definition at line 28 of file TextWrapper.php.

Member Function Documentation

Erebot\Interfaces\TextWrapper::__toString ( )

Returns the wrapped text (untouched).

Return values
stringThe text wrapped by this instance.

Implemented in Erebot\TextWrapper.

Erebot\Interfaces\TextWrapper::countTokens (   $separator = ' ')

Returns the number of chunks (tokens) obtained by splitting the wrapped text using the given separator. Whitespaces are squeezed together in the process, no matter what separator is actually used.

Parameters
null | string$separator(optional) The separator to use while splitting the text. The default is to split it on whitespaces (' ').
Return values
intThe number of tokens in the string.

Implemented in Erebot\TextWrapper.

Erebot\Interfaces\TextWrapper::getTokens (   $start,
  $length = 0,
  $separator = ' ' 
)

Splits the wrapped text using the given separator and returns only some of the chunks (tokens) as a new string. Whitespaces are squeezed together in the process, no matter what separator is actually used.

Parameters
int$startOffset of the first chunk to return (starting at 0). If negative, it starts at the end of the wrapped text.
null | int$length(optional) Number of chunks to return in the new string. If set to 0 (the default), returns all chunks from $start onward until the end of the wrapped text.
null | string$separator(optional) The separator to use while splitting the text. The default is to split it on whitespaces (' ').
Return values
stringAt most $length chunks (if $length > 0) and its whitespaces squeezed.

Implemented in Erebot\TextWrapper.


The documentation for this interface was generated from the following file: