Zend Framework  3.0
Static Public Member Functions | Static Protected Attributes | List of all members
StringUtils Class Reference

Utility class for handling strings of different character encodings using available PHP extensions. More...

Static Public Member Functions

static getRegisteredWrappers ()
 Get registered wrapper classes.
 
static registerWrapper ($wrapper)
 Register a string wrapper class.
 
static unregisterWrapper ($wrapper)
 Unregister a string wrapper class.
 
static resetRegisteredWrappers ()
 Reset all registered wrappers so the default wrappers will be used.
 
static getWrapper ($encoding= 'UTF-8', $convertEncoding=null)
 Get the first string wrapper supporting the given character encoding and supports to convert into the given convert encoding.
 
static getSingleByteEncodings ()
 Get a list of all known single-byte character encodings.
 
static isSingleByteEncoding ($encoding)
 Check if a given encoding is a known single-byte character encoding.
 
static isValidUtf8 ($str)
 Check if a given string is valid UTF-8 encoded.
 
static hasPcreUnicodeSupport ()
 Is PCRE compiled with Unicode support?
 

Static Protected Attributes

static $wrapperRegistry = null
 
static $singleByteEncodings
 
static $hasPcreUnicodeSupport = null
 

Detailed Description

Utility class for handling strings of different character encodings using available PHP extensions.

Declared abstract, as we have no need for instantiation.

Member Function Documentation

static getRegisteredWrappers ( )
static

Get registered wrapper classes.

Returns
string[]
static getSingleByteEncodings ( )
static

Get a list of all known single-byte character encodings.

Returns
string[]
static getWrapper (   $encoding = 'UTF-8',
  $convertEncoding = null 
)
static

Get the first string wrapper supporting the given character encoding and supports to convert into the given convert encoding.

Parameters
string$encodingCharacter encoding to support
string | null$convertEncodingOPTIONAL character encoding to convert in
Returns
StringWrapperInterface
Exceptions
Exception\RuntimeExceptionIf no wrapper supports given character encodings
static hasPcreUnicodeSupport ( )
static

Is PCRE compiled with Unicode support?

Returns
bool
static isSingleByteEncoding (   $encoding)
static

Check if a given encoding is a known single-byte character encoding.

Parameters
string$encoding
Returns
bool
static isValidUtf8 (   $str)
static

Check if a given string is valid UTF-8 encoded.

Parameters
string$str
Returns
bool
static registerWrapper (   $wrapper)
static

Register a string wrapper class.

Parameters
string$wrapper
Returns
void
static resetRegisteredWrappers ( )
static

Reset all registered wrappers so the default wrappers will be used.

Returns
void
static unregisterWrapper (   $wrapper)
static

Unregister a string wrapper class.

Parameters
string$wrapper
Returns
void

Member Data Documentation

$hasPcreUnicodeSupport = null
staticprotected
$singleByteEncodings
staticprotected
Initial value:
= [
'ASCII', '7BIT', '8BIT',
'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4', 'ISO-8859-5',
'ISO-8859-6', 'ISO-8859-7', 'ISO-8859-8', 'ISO-8859-9', 'ISO-8859-10',
'ISO-8859-11', 'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'ISO-8859-16',
'CP-1251', 'CP-1252',
]
$wrapperRegistry = null
staticprotected