C# Class Pchp.Core.Convert

Afficher le fichier Open project: iolevel/peachpie

Méthodes publiques

Méthode Description
AlphaNumericToDigit ( char c ) : int

Converts a character to a digit.

AsCallable ( PhpValue value ) : IPhpCallable

Gets value as a callable object that can be invoked dynamically.

AsCallable ( string value ) : IPhpCallable

Creates a callable object from string value.

AsObject ( PhpValue value ) : object

Gets underlaying class instance or null.

IsInstanceOf ( object value, Reflection tinfo ) : bool

Resolves whether given instance value is of given type tinfo.

StringToDouble ( string str ) : double

Converts a string to double using conversion algorithm in a manner of PHP.

StringToLongInteger ( string str ) : long

Converts a string to long integer using conversion algorithm in a manner of PHP.

StringToNumber ( string str, long &longValue, double &doubleValue ) : NumberInfo

Converts string into integer, long integer and double value using conversion algorithm in a manner of PHP.

SubstringToDouble ( string str, int length, int &position ) : double

Converts a part of a string starting on a specified position to a double.

SubstringToLongInteger ( string str, int length, int &position ) : long

Converts a part of a string starting on a specified position to a long integer.

ToArray ( PhpValue value ) : PhpArray

COnverts value to an array.

ToBoolean ( byte value ) : bool

Converts string to boolean according to PHP.

ToBoolean ( char value ) : bool

Converts string to boolean according to PHP.

ToBoolean ( object value ) : bool

Converts class instance to boolean according to PHP.

ToBoolean ( string value ) : bool

Converts string to boolean according to PHP.

ToClass ( IPhpArray array ) : object

Converts given array object to stdClass.

ToClass ( PhpValue value ) : object

Converts given value to a class object.

ToIntStringKey ( PhpValue value ) : IntStringKey

Converts given value to an array key.

ToNumber ( string str, PhpNumber &number ) : NumberInfo
ToNumber ( PhpValue value ) : PhpNumber

Performs conversion of a value to a number. Additional conversion warnings may be thrown.

ToString ( bool value ) : string

Gets string representation of a boolean value (according to PHP, it is "1" or "").

ToString ( double value, Context ctx ) : string

Gets string representation of a floating point number value.

ToString ( int value ) : string

Gets string representation of an integer value.

ToString ( long value ) : string

Gets string representation of an integer value.

TryToIntStringKey ( PhpValue value, IntStringKey &key ) : bool

Tries conversion to an array key.

Private Methods

Méthode Description
IsNumber ( string s, int limit, int from, int &l, int &d, long &longValue, double &doubleValue ) : NumberInfo

Converts a string to integer value and double value and decides whether it represents a number as a whole.

ParseDouble ( string str, bool sign, double &doubleValue ) : void

Parses given string as a Double, using invariant culture and proper number styles.

Method Details

AlphaNumericToDigit() public static méthode

Converts a character to a digit.
public static AlphaNumericToDigit ( char c ) : int
c char The character [0-9A-Za-z].
Résultat int

AsCallable() public static méthode

Gets value as a callable object that can be invoked dynamically.
public static AsCallable ( PhpValue value ) : IPhpCallable
value PhpValue
Résultat IPhpCallable

AsCallable() public static méthode

Creates a callable object from string value.
public static AsCallable ( string value ) : IPhpCallable
value string
Résultat IPhpCallable

AsObject() public static méthode

Gets underlaying class instance or null.
public static AsObject ( PhpValue value ) : object
value PhpValue
Résultat object

IsInstanceOf() public static méthode

Resolves whether given instance value is of given type tinfo.
public static IsInstanceOf ( object value, Reflection tinfo ) : bool
value object Value to be checked.
tinfo Reflection Type descriptor.
Résultat bool

StringToDouble() public static méthode

Converts a string to double using conversion algorithm in a manner of PHP.
public static StringToDouble ( string str ) : double
str string The string to convert.
Résultat double

StringToLongInteger() public static méthode

Converts a string to long integer using conversion algorithm in a manner of PHP.
public static StringToLongInteger ( string str ) : long
str string The string to convert.
Résultat long

StringToNumber() public static méthode

Converts string into integer, long integer and double value using conversion algorithm in a manner of PHP.
is a null reference.
public static StringToNumber ( string str, long &longValue, double &doubleValue ) : NumberInfo
str string The string to convert.
longValue long The result of conversion to long integer.
doubleValue double The result of conversion to double.
Résultat NumberInfo

SubstringToDouble() public static méthode

Converts a part of a string starting on a specified position to a double.
public static SubstringToDouble ( string str, int length, int &position ) : double
str string The string to be parsed. Cannot be null.
length int Maximal length of the substring to parse.
position int /// The position where to start. Points to the first character after the substring storing the double /// when returned. ///
Résultat double

SubstringToLongInteger() public static méthode

Converts a part of a string starting on a specified position to a long integer.
public static SubstringToLongInteger ( string str, int length, int &position ) : long
str string The string to be parsed.
length int Maximal length of the substring to parse.
position int /// The position where to start. Points to the first character after the substring storing the integer /// when returned. ///
Résultat long

ToArray() public static méthode

COnverts value to an array.
public static ToArray ( PhpValue value ) : PhpArray
value PhpValue
Résultat PhpArray

ToBoolean() public static méthode

Converts string to boolean according to PHP.
public static ToBoolean ( byte value ) : bool
value byte
Résultat bool

ToBoolean() public static méthode

Converts string to boolean according to PHP.
public static ToBoolean ( char value ) : bool
value char
Résultat bool

ToBoolean() public static méthode

Converts class instance to boolean according to PHP.
public static ToBoolean ( object value ) : bool
value object
Résultat bool

ToBoolean() public static méthode

Converts string to boolean according to PHP.
public static ToBoolean ( string value ) : bool
value string
Résultat bool

ToClass() public static méthode

Converts given array object to stdClass.
public static ToClass ( IPhpArray array ) : object
array IPhpArray Non-null reference to a PHP array.
Résultat object

ToClass() public static méthode

Converts given value to a class object.
public static ToClass ( PhpValue value ) : object
value PhpValue
Résultat object

ToIntStringKey() public static méthode

Converts given value to an array key.
public static ToIntStringKey ( PhpValue value ) : IntStringKey
value PhpValue
Résultat IntStringKey

ToNumber() public static méthode

public static ToNumber ( string str, PhpNumber &number ) : NumberInfo
str string
number PhpNumber
Résultat NumberInfo

ToNumber() public static méthode

Performs conversion of a value to a number. Additional conversion warnings may be thrown.
public static ToNumber ( PhpValue value ) : PhpNumber
value PhpValue
Résultat PhpNumber

ToString() public static méthode

Gets string representation of a boolean value (according to PHP, it is "1" or "").
public static ToString ( bool value ) : string
value bool
Résultat string

ToString() public static méthode

Gets string representation of a floating point number value.
public static ToString ( double value, Context ctx ) : string
value double
ctx Context
Résultat string

ToString() public static méthode

Gets string representation of an integer value.
public static ToString ( int value ) : string
value int
Résultat string

ToString() public static méthode

Gets string representation of an integer value.
public static ToString ( long value ) : string
value long
Résultat string

TryToIntStringKey() public static méthode

Tries conversion to an array key.
public static TryToIntStringKey ( PhpValue value, IntStringKey &key ) : bool
value PhpValue
key IntStringKey
Résultat bool