Class ImmutableString
A String object stores a native PHP string and implements an advanced interface. Strings are per default immutable.
Strings operations are based on an associated character set, which defaults to the currently active character set during creating of the ImmutableString object. Therefore if String instances are equal but differ in their character set, their hash values do not match.
Due to backward-incompatible changes in PHP 7, string and other native
type names will be reserved keywords. Therefore this class had been renamed
from previously Core\String in Medusa Core 3.2.
- Core\Object implements Core\Chainable
-
Core\Set
implements
Core\Accessor
-
Core\Type\ImmutableString
implements
ArrayAccess,
Core\Comparable,
Core\Equality,
Iterator,
Core\Masquerade
Direct known subclasses
Package: Core\Type\String
Since: 3.0
Requires: PHP 5.3
Version: 2.0
Located at Type/ImmutableString.inc.php
Methods summary
public
|
|
public
string
|
|
public
String
|
|
public static
string
|
|
public
integer
|
|
public
String
|
#
convertTo(
Returns a String instance representing the same Unicode string with a different character set. |
public
string
|
|
public
String
|
|
public static
string
|
|
public
string
|
#
hash( )
Returns a hash value based on the actual string. The calculated hash value is based on the binary String and the associated character set. |
public
boolean
|
#
isEqualTo( $value )
Tests, whether the current String is equal to another value or object. Two String instances are equal if and only if they are based on the same character set and their string buffers are binary equal. |
public
integer
|
|
public static
String
|
|
public
|
|
public
boolean
|
|
public
string
|
|
public
|
#
offsetSet( integer $index, string $value )
Not available for immutable String instances; raises an exception. |
public
|
|
public
|
|
public
string[]
|
|
public static
string[]
|
#
splitSettingListStr( string $string )
Returns an array of list elements extracted from the given string. |
public
string
|
|
public
boolean
|
Methods inherited from Core\Object
__autocreateFactory(),
__call(),
__processParameters(),
attachMethod(),
chain(),
getValueForKey(),
getValueForKeyPath(),
getValueForUndefinedKey(),
issetValueForKey(),
setValueForKey(),
setValueForKeyPath(),
setValueForUndefinedKey(),
uuid()
Constants summary
Constants inherited from Core\Object
AnyParameterType,
AutochainParameterType,
AutocreateParameterType,
BooleanParameterType,
CharParameterType,
EnumParameterType,
IntegerParameterType,
RealParameterType,
StringParameterType,
UserParameterType
Properties summary
protected
string
|
$_v_binaryString
The original, binary string used to initialise the instance. |
|
protected
|
$_v_charset
The character set instance. Defaults to the currently active character set during initialisation. |
|
protected
integer
|
$_v_length
Buffered string length value in characters (not bytes). |
|
protected
string
|
$_hash
Hash. |
|
protected
integer
|
$_position
Iterator position. |
Magic properties
public read-only
string
|
$binaryString
Internal binary string representation. |
public read-only
|
$charset
Character set of the internal binary string. |
public read-only
string
|
$hash
Hash based on binary string and character set. |
public read-only
integer
|
$length
Length of the string in characters (not bytes). |