16 * @var kintVariableData[] array of kintVariableData objects or strings; displayed collapsed, each element from
17 * the array is a separate possible representation of the dumped var
19 public $extendedValue;
20 /** @var string inline value */
23 /** @var kintVariableData[] array of alternative representations for same variable, don't use in custom parsers */
24 public $_alternatives;
26 /* *******************************************
30 private static $_supportedCharsets = array(
32 'Windows-1252', # Western; includes iso-8859-1
35 # all other charsets cannot be differentiated by PHP and/or are not supported by mb_* functions,
36 # I need a better means of detecting the codeset, no idea how though :(
38 // 'iso-8859-13', # Baltic
39 // 'windows-1251', # Cyrillic
40 // 'windows-1250', # Central European
41 // 'shift_jis', # Japanese
42 // 'iso-2022-jp', # Japanese
45 protected static function _detectEncoding( $value )
48 if ( function_exists( 'mb_detect_encoding' ) ) {
49 $mbDetected = mb_detect_encoding( $value );
50 if ( $mbDetected === 'ASCII' ) return 'ASCII';
54 if ( !function_exists( 'iconv' ) ) {
55 return !empty( $mbDetected ) ? $mbDetected : 'UTF-8';
59 foreach ( Kint::$charEncodings as $encoding ) {
60 # fuck knows why, //IGNORE and //TRANSLIT still throw notice
61 if ( md5( @iconv( $encoding, $encoding, $value ) ) === $md5 ) {
70 * returns whether the array:
72 * 2) in sequence starting from zero
78 protected static function _isSequential( array $array )
80 return array_keys( $array ) === range( 0, count( $array ) - 1 );
83 protected static function _strlen( $string, $encoding = null )
85 if ( function_exists( 'mb_strlen' ) ) {
86 $encoding or $encoding = self::_detectEncoding( $string );
87 return mb_strlen( $string, $encoding );
89 return strlen( $string );
93 protected static function _substr( $string, $start, $end, $encoding = null )
95 if ( function_exists( 'mb_substr' ) ) {
96 $encoding or $encoding = self::_detectEncoding( $string );
97 return mb_substr( $string, $start, $end, $encoding );
99 return substr( $string, $start, $end );