public function AbstractStringWrapper::convert in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/zendframework/zend-stdlib/src/StringWrapper/AbstractStringWrapper.php \Zend\Stdlib\StringWrapper\AbstractStringWrapper::convert()
Convert a string from defined character encoding to the defined convert encoding
Parameters
string $str:
bool $reverse:
Return value
string|false
Overrides StringWrapperInterface::convert
2 methods override AbstractStringWrapper::convert()
- Iconv::convert in vendor/
zendframework/ zend-stdlib/ src/ StringWrapper/ Iconv.php - Convert a string from defined encoding to the defined convert encoding
- MbString::convert in vendor/
zendframework/ zend-stdlib/ src/ StringWrapper/ MbString.php - Convert a string from defined encoding to the defined convert encoding
File
- vendor/
zendframework/ zend-stdlib/ src/ StringWrapper/ AbstractStringWrapper.php, line 115
Class
Namespace
Zend\Stdlib\StringWrapperCode
public function convert($str, $reverse = false) {
$encoding = $this
->getEncoding();
$convertEncoding = $this
->getConvertEncoding();
if ($convertEncoding === null) {
throw new Exception\LogicException('No convert encoding defined');
}
if ($encoding === $convertEncoding) {
return $str;
}
$from = $reverse ? $convertEncoding : $encoding;
$to = $reverse ? $encoding : $convertEncoding;
throw new Exception\RuntimeException(sprintf('Converting from "%s" to "%s" isn\'t supported by this string wrapper', $from, $to));
}