StringIterator
in package
Common interface for all rules
Tags
Table of Contents
- $cursor : int
- Position of the iterator
- $string : string
- String to be iterated
- __construct() : mixed
- Constructor
- current() : int
- Method returns current cursor of the string
- end() : int
- Method returns ending cursor of the string
- get() : string
- Method returns char in the position of cursor
- next() : bool
- Method shifts iterator to the next position
Properties
$cursor
Position of the iterator
private
int
$cursor
= 0
$string
String to be iterated
private
string
$string
= ''
Methods
__construct()
Constructor
public
__construct(string $stringToBeIterated) : mixed
Parameters
- $stringToBeIterated : string
-
string to be iterated
Return values
mixed —current()
Method returns current cursor of the string
public
current() : int
Return values
int —current cursor of the string
end()
Method returns ending cursor of the string
public
end() : int
Return values
int —ending cursor of the string
get()
Method returns char in the position of cursor
public
get() : string
Return values
string —char in the position of cursor
next()
Method shifts iterator to the next position
public
next([int $shift = 1 ]) : bool
Parameters
- $shift : int = 1
-
shift value
Return values
bool —true if the string can be iterated further, false otherwise