You are here

public static function AbstractStringWrapper::isSupported in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-stdlib/src/StringWrapper/AbstractStringWrapper.php \Zend\Stdlib\StringWrapper\AbstractStringWrapper::isSupported()

Check if the given character encoding is supported by this wrapper and the character encoding to convert to is also supported.

Parameters

string $encoding:

string|null $convertEncoding:

Return value

bool

Overrides StringWrapperInterface::isSupported

1 method overrides AbstractStringWrapper::isSupported()
Native::isSupported in vendor/zendframework/zend-stdlib/src/StringWrapper/Native.php
Check if the given character encoding is supported by this wrapper and the character encoding to convert to is also supported.

File

vendor/zendframework/zend-stdlib/src/StringWrapper/AbstractStringWrapper.php, line 37

Class

AbstractStringWrapper

Namespace

Zend\Stdlib\StringWrapper

Code

public static function isSupported($encoding, $convertEncoding = null) {
  $supportedEncodings = static::getSupportedEncodings();
  if (!in_array(strtoupper($encoding), $supportedEncodings)) {
    return false;
  }
  if ($convertEncoding !== null && !in_array(strtoupper($convertEncoding), $supportedEncodings)) {
    return false;
  }
  return true;
}