class Intl in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/zendframework/zend-stdlib/src/StringWrapper/Intl.php \Zend\Stdlib\StringWrapper\Intl
Hierarchy
- class \Zend\Stdlib\StringWrapper\AbstractStringWrapper implements StringWrapperInterface
- class \Zend\Stdlib\StringWrapper\Intl
Expanded class hierarchy of Intl
File
- vendor/
zendframework/ zend-stdlib/ src/ StringWrapper/ Intl.php, line 14
Namespace
Zend\Stdlib\StringWrapperView source
class Intl extends AbstractStringWrapper {
/**
* List of supported character sets (upper case)
*
* @var string[]
*/
protected static $encodings = [
'UTF-8',
];
/**
* Get a list of supported character encodings
*
* @return string[]
*/
public static function getSupportedEncodings() {
return static::$encodings;
}
/**
* Constructor
*
* @throws Exception\ExtensionNotLoadedException
*/
public function __construct() {
if (!extension_loaded('intl')) {
throw new Exception\ExtensionNotLoadedException('PHP extension "intl" is required for this wrapper');
}
}
/**
* Returns the length of the given string
*
* @param string $str
* @return int|false
*/
public function strlen($str) {
return grapheme_strlen($str);
}
/**
* Returns the portion of string specified by the start and length parameters
*
* @param string $str
* @param int $offset
* @param int|null $length
* @return string|false
*/
public function substr($str, $offset = 0, $length = null) {
// Due fix of PHP #62759 The third argument returns an empty string if is 0 or null.
if ($length !== null) {
return grapheme_substr($str, $offset, $length);
}
return grapheme_substr($str, $offset);
}
/**
* Find the position of the first occurrence of a substring in a string
*
* @param string $haystack
* @param string $needle
* @param int $offset
* @return int|false
*/
public function strpos($haystack, $needle, $offset = 0) {
return grapheme_strpos($haystack, $needle, $offset);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AbstractStringWrapper:: |
protected | property | An optionally character encoding to convert to | |
AbstractStringWrapper:: |
protected | property | The character encoding working on | 1 |
AbstractStringWrapper:: |
public | function |
Convert a string from defined character encoding to the defined convert encoding Overrides StringWrapperInterface:: |
2 |
AbstractStringWrapper:: |
public | function |
Get the defined character encoding to convert to Overrides StringWrapperInterface:: |
|
AbstractStringWrapper:: |
public | function |
Get the defined character encoding to work with Overrides StringWrapperInterface:: |
|
AbstractStringWrapper:: |
public static | function |
Check if the given character encoding is supported by this wrapper
and the character encoding to convert to is also supported. Overrides StringWrapperInterface:: |
1 |
AbstractStringWrapper:: |
public | function |
Set character encoding working with and convert to Overrides StringWrapperInterface:: |
1 |
AbstractStringWrapper:: |
public | function |
Pad a string to a certain length with another string Overrides StringWrapperInterface:: |
|
AbstractStringWrapper:: |
public | function |
Wraps a string to a given number of characters Overrides StringWrapperInterface:: |
|
Intl:: |
protected static | property | List of supported character sets (upper case) | |
Intl:: |
public static | function |
Get a list of supported character encodings Overrides StringWrapperInterface:: |
|
Intl:: |
public | function |
Returns the length of the given string Overrides StringWrapperInterface:: |
|
Intl:: |
public | function |
Find the position of the first occurrence of a substring in a string Overrides StringWrapperInterface:: |
|
Intl:: |
public | function |
Returns the portion of string specified by the start and length parameters Overrides StringWrapperInterface:: |
|
Intl:: |
public | function | Constructor |