Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

StringWrapper::convert() Renamed second argument to and fixed phpdoc

  • Loading branch information...
commit 68b01196e37ac3ecde389f657dbe482dd0783359 1 parent 54d97d5
@marc-mabe authored
View
11 library/Zend/Stdlib/StringWrapper/AbstractStringWrapper.php
@@ -105,18 +105,17 @@ public function setEncoding($encoding, $convertEncoding = null)
* Convert a string from one character encoding to another
*
* @param string $str
- * @param boolean $backward
+ * @param boolean $reverse
* @return string|false
*/
- public function convert($str, $backward = false)
+ public function convert($str, $reverse = false)
{
- $from = $backward ? $this->convertEncoding : $this->encoding;
- $to = $backward ? $this->encoding : $this->convertEncoding;
-
- if ($to == $from) {
+ if ($this->encoding === $this->convertEncoding) {
return $str;
}
+ $from = $reverse ? $this->convertEncoding : $this->encoding;
+ $to = $reverse ? $this->encoding : $this->convertEncoding;
throw new Exception\RuntimeException(sprintf(
'Converting from "%s" to "%s" isn\'t supported by this string wrapper',
$from,
View
11 library/Zend/Stdlib/StringWrapper/Iconv.php
@@ -185,15 +185,14 @@ public function strpos($haystack, $needle, $offset = 0)
/**
* Convert a string from one character encoding to another
*
- * @param string $str
- * @param string $toEncoding
- * @param string $fromEncoding
+ * @param string $str
+ * @param boolean $reverse
* @return string|false
*/
- public function convert($str, $backword = false)
+ public function convert($str, $reverse = false)
{
- $fromEncoding = $backword ? $this->convertEncoding : $this->encoding;
- $toEncoding = $backword ? $this->encoding : $this->convertEncoding;
+ $fromEncoding = $reverse ? $this->convertEncoding : $this->encoding;
+ $toEncoding = $reverse ? $this->encoding : $this->convertEncoding;
return iconv($fromEncoding, $toEncoding, $str);
}
}
View
11 library/Zend/Stdlib/StringWrapper/MbString.php
@@ -106,15 +106,14 @@ public function strpos($haystack, $needle, $offset = 0)
/**
* Convert a string from one character encoding to another
*
- * @param string $str
- * @param string $toEncoding
- * @param string $fromEncoding
+ * @param string $str
+ * @param boolean $reverse
* @return string|false
*/
- public function convert($str, $backword = false)
+ public function convert($str, $reverse = false)
{
- $fromEncoding = $backword ? $this->convertEncoding : $this->encoding;
- $toEncoding = $backword ? $this->encoding : $this->convertEncoding;
+ $fromEncoding = $reverse ? $this->convertEncoding : $this->encoding;
+ $toEncoding = $reverse ? $this->encoding : $this->convertEncoding;
return mb_convert_encoding($str, $toEncoding, $fromEncoding);
}
}
View
4 library/Zend/Stdlib/StringWrapper/StringWrapperInterface.php
@@ -84,10 +84,10 @@ public function strpos($haystack, $needle, $offset = 0);
* Convert a string from one character encoding to another
*
* @param string $str
- * @param boolean $backward
+ * @param boolean $reverse
* @return string|false
*/
- public function convert($str, $backward = false);
+ public function convert($str, $reverse = false);
/**
* Wraps a string to a given number of characters
Please sign in to comment.
Something went wrong with that request. Please try again.