Erebot  latest
A modular IRC bot for PHP 5.3+
Erebot\IrcTextWrapper Class Reference

A wrapper that correctly splits messages received from an IRC server (data part). More...

+ Inheritance diagram for Erebot\IrcTextWrapper:

Public Member Functions

 __construct ($parts)
 
 __toString ()
 
 count ()
 
 current ()
 
 key ()
 
 next ()
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 rewind ()
 
 valid ()
 

Protected Attributes

 $parts
 The parts wrapped by this instance.
 
 $position
 Position in the text.
 

Detailed Description

A wrapper that correctly splits messages received from an IRC server (data part).

See also
RFC 1459 and RFC 2812 (ยง2.3.1) for information on the format recognized by this wrapper.

Definition at line 32 of file IrcTextWrapper.php.

Constructor & Destructor Documentation

Erebot\IrcTextWrapper::__construct (   $parts)

Constructs a new instance of a text wrapper.

Parameters
string | array$partsThe text to wrap.

Definition at line 46 of file IrcTextWrapper.php.

Member Function Documentation

Erebot\IrcTextWrapper::__toString ( )

Returns the wrapped text.

Return values
stringThe text wrapped by this instance.

Implements Erebot\Interfaces\IrcTextWrapper.

Definition at line 98 of file IrcTextWrapper.php.

Erebot\IrcTextWrapper::count ( )

Count elements of an object.

This method is executed when using the count() function on an object implementing the Countable interface.

Return values
intThe custom count as an integer.
See also
http://php.net/countable.count.php

Implements Countable.

Definition at line 119 of file IrcTextWrapper.php.

Erebot\IrcTextWrapper::current ( )

Returns the current element.

Return values
mixedCurrent element.
See also
http://php.net/iterator.current.php

Implements Iterator.

Definition at line 125 of file IrcTextWrapper.php.

Erebot\IrcTextWrapper::key ( )

Returns the key of the current element.

Return values
scalarReturns scalar on success, or null on failure.
Note
Issues E_NOTICE on failure.
See also
http://php.net/iterator.key.php

Implements Iterator.

Definition at line 131 of file IrcTextWrapper.php.

Erebot\IrcTextWrapper::next ( )

Moves the current position to the next element.

Note
This method is called after each foreach loop.
See also
http://php.net/iterator.next.php

Implements Iterator.

Definition at line 137 of file IrcTextWrapper.php.

Erebot\IrcTextWrapper::offsetExists (   $offset)

Whether or not an offset exists.

This method is executed when using isset() or empty() on objects implementing ArrayAccess.

Parameters
mixed$offsetAn offset to check for.
Return values
booltrue is returned when the offset exists, false when it doesn't.
See also
http://php.net/arrayaccess.offsetexists.php
Note
When using empty() ArrayAccess::offsetGet() will be called and checked for emptyness only if ArrayAccess::offsetExists() returns true.

Implements ArrayAccess.

Definition at line 155 of file IrcTextWrapper.php.

Erebot\IrcTextWrapper::offsetGet (   $offset)

Returns the value at specified offset.

This method is executed when checking if offset is empty().

Parameters
mixed$offsetThe offset to retrieve.
Return values
mixedValue at the specified offset.
See also
http://php.net/arrayaccess.offsetget.php

Implements ArrayAccess.

Definition at line 161 of file IrcTextWrapper.php.

Erebot\IrcTextWrapper::offsetSet (   $offset,
  $value 
)

Assigns a value to the specified offset.

Parameters
mixed$offsetThe offset to assign the value to.
mixed$valueThe value to set.
See also
http://php.net/arrayaccess.offsetset.php

Implements ArrayAccess.

Definition at line 173 of file IrcTextWrapper.php.

Erebot\IrcTextWrapper::offsetUnset (   $offset)

Unsets an offset.

Parameters
mixed$offsetThe offset to unset.
See also
http://php.net/arrayaccess.offsetunset.php
Note
This method will not be called when type-casting to (unset).

Implements ArrayAccess.

Definition at line 179 of file IrcTextWrapper.php.

Erebot\IrcTextWrapper::rewind ( )

Rewinds back to the first element of the Iterator.

Note
This is the first method called when starting a foreach loop. It will not be executed after foreach loops.
See also
http://php.net/iterator.rewind.php

Implements Iterator.

Definition at line 143 of file IrcTextWrapper.php.

Erebot\IrcTextWrapper::valid ( )

Checks if current position is valid.

This method is called after Iterator::rewind() and Iterator::next() to check if the current position is valid.

Return values
booltrue if the current position is valid, false otherwise.
Note
If Iterator::valid() returns false, the foreach loop will be terminated.
See also
http://php.net/iterator.valid.php

Implements Iterator.

Definition at line 149 of file IrcTextWrapper.php.


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