summaryrefslogtreecommitdiff
path: root/includes/StringUtils.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
committerPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
commitca32f08966f1b51fcb19460f0996bb0c4048e6fe (patch)
treeec04cc15b867bc21eedca904cea9af0254531a11 /includes/StringUtils.php
parenta22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c (diff)
Update to MediaWiki 1.18.0
* also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing
Diffstat (limited to 'includes/StringUtils.php')
-rw-r--r--includes/StringUtils.php22
1 files changed, 17 insertions, 5 deletions
diff --git a/includes/StringUtils.php b/includes/StringUtils.php
index c1e617a0..f405e616 100644
--- a/includes/StringUtils.php
+++ b/includes/StringUtils.php
@@ -13,6 +13,13 @@ class StringUtils {
* Compared to delimiterReplace(), this implementation is fast but memory-
* hungry and inflexible. The memory requirements are such that I don't
* recommend using it on anything but guaranteed small chunks of text.
+ *
+ * @param $startDelim
+ * @param $endDelim
+ * @param $replace
+ * @param $subject
+ *
+ * @return string
*/
static function hungryDelimiterReplace( $startDelim, $endDelim, $replace, $subject ) {
$segments = explode( $startDelim, $subject );
@@ -36,17 +43,19 @@ class StringUtils {
* This implementation is slower than hungryDelimiterReplace but uses far less
* memory. The delimiters are literal strings, not regular expressions.
*
+ * If the start delimiter ends with an initial substring of the end delimiter,
+ * e.g. in the case of C-style comments, the behaviour differs from the model
+ * regex. In this implementation, the end must share no characters with the
+ * start, so e.g. /*\/ is not considered to be both the start and end of a
+ * comment. /*\/xy/*\/ is considered to be a single comment with contents /xy/.
+ *
* @param $startDelim String: start delimiter
* @param $endDelim String: end delimiter
* @param $callback Callback: function to call on each match
* @param $subject String
* @param $flags String: regular expression flags
+ * @return string
*/
- # If the start delimiter ends with an initial substring of the end delimiter,
- # e.g. in the case of C-style comments, the behaviour differs from the model
- # regex. In this implementation, the end must share no characters with the
- # start, so e.g. /*/ is not considered to be both the start and end of a
- # comment. /*/xy/*/ is considered to be a single comment with contents /xy/.
static function delimiterReplaceCallback( $startDelim, $endDelim, $callback, $subject, $flags = '' ) {
$inputPos = 0;
$outputPos = 0;
@@ -180,6 +189,9 @@ class StringUtils {
/**
* Workalike for explode() with limited memory usage.
* Returns an Iterator
+ * @param $separator
+ * @param $subject
+ * @return \ArrayIterator|\ExplodeIterator
*/
static function explode( $separator, $subject ) {
if ( substr_count( $subject, $separator ) > 1000 ) {