/**
* More or less "markup-safe" explode()
* Ignores any instances of the separator inside <...>
- * @param $separator String
- * @param $text String
+ * @param string $separator
+ * @param string $text
* @return array
*/
static function explodeMarkup( $separator, $text ) {
* Escape a string to make it suitable for inclusion in a preg_replace()
* replacement parameter.
*
- * @param $string String
- * @return String
+ * @param string $string
+ * @return string
*/
static function escapeRegexReplacement( $string ) {
$string = str_replace( '\\', '\\\\', $string );
/**
* Workalike for explode() with limited memory usage.
* Returns an Iterator
- * @param $separator
- * @param $subject
+ * @param string $separator
+ * @param string $subject
* @return ArrayIterator|ExplodeIterator
*/
static function explode( $separator, $subject ) {
var $r;
/**
- * @param $r string
+ * @param string $r
*/
function __construct( $r ) {
$this->r = $r;
}
/**
- * @param $matches array
+ * @param array $matches
* @return string
*/
function replace( $matches ) {
/**
* @param $from
* @param $to
- * @param $index int
+ * @param int $index
*/
function __construct( $from, $to, $index = 0 ) {
$this->from = $from;
}
/**
- * @param $matches array
+ * @param array $matches
* @return mixed
*/
function replace( $matches ) {
/**
* @param $table
- * @param $index int
+ * @param int $index
*/
function __construct( $table, $index = 0 ) {
$this->table = $table;
}
/**
- * @param $matches array
+ * @param array $matches
* @return mixed
*/
function replace( $matches ) {
/**
* Set the whole replacement array at once
+ * @param array $data
*/
function setArray( $data ) {
$this->data = $data;
/**
* Set an element of the replacement array
- * @param $from string
- * @param $to string
+ * @param string $from
+ * @param string $to
*/
function setPair( $from, $to ) {
$this->data[$from] = $to;
}
/**
- * @param $data array
+ * @param array $data
*/
function mergeArray( $data ) {
$this->data = array_merge( $this->data, $data );
}
/**
- * @param $other
+ * @param ReplacementArray $other
*/
function merge( $other ) {
$this->data = array_merge( $this->data, $other->data );
}
/**
- * @param $from string
+ * @param string $from
*/
function removePair( $from ) {
unset( $this->data[$from] );
}
/**
- * @param $data array
+ * @param array $data
*/
function removeArray( $data ) {
foreach ( $data as $from => $to ) {
}
/**
- * @param $subject string
+ * @param string $subject
* @return string
*/
function replace( $subject ) {
/**
* Construct a DelimIterator
- * @param $delim string
- * @param $s string
+ * @param string $delim
+ * @param string $subject
*/
- function __construct( $delim, $s ) {
- $this->subject = $s;
+ function __construct( $delim, $subject ) {
+ $this->subject = $subject;
$this->delim = $delim;
// Micro-optimisation (theoretical)
- $this->subjectLength = strlen( $s );
+ $this->subjectLength = strlen( $subject );
$this->delimLength = strlen( $delim );
$this->rewind();
return $this->current;
}
+ /**
+ * @return int|bool Current position or boolean false if invalid
+ */
function key() {
return $this->curPos;
}