You are here

public static function Native::isSupported in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-stdlib/src/StringWrapper/Native.php \Zend\Stdlib\StringWrapper\Native::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 AbstractStringWrapper::isSupported

File

vendor/zendframework/zend-stdlib/src/StringWrapper/Native.php, line 33

Class

Native

Namespace

Zend\Stdlib\StringWrapper

Code

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

  // This adapter doesn't support to convert between encodings
  if ($convertEncoding !== null && $encodingUpper !== strtoupper($convertEncoding)) {
    return false;
  }
  return true;
}