'; $extendedPresent = $kintVar->extendedValue !== null || $kintVar->alternatives !== null; if ( $extendedPresent ) { $class = 'kint-parent'; if ( Kint::$expandedByDefault ) { $class .= ' kint-show'; } $output .= '
'; } else { $output .= '
'; } $output .= self::_drawHeader( $kintVar ) . $kintVar->value . '
'; if ( $extendedPresent ) { $output .= '
'; } if ( isset( $kintVar->extendedValue ) ) { if ( is_array( $kintVar->extendedValue ) ) { foreach ( $kintVar->extendedValue as $v ) { $output .= self::decorate( $v ); } } elseif ( is_string( $kintVar->extendedValue ) ) { $output .= '
' . $kintVar->extendedValue . '
'; } else { $output .= self::decorate( $kintVar->extendedValue ); //it's kint's container } } elseif ( isset( $kintVar->alternatives ) ) { $output .= ""; } if ( $extendedPresent ) { $output .= '
'; } $output .= ''; return $output; } private static function _drawHeader( kintVariableData $kintVar, $verbose = true ) { $output = ''; if ( $verbose ) { if ( $kintVar->access !== null ) { $output .= "" . $kintVar->access . " "; } if ( $kintVar->name !== null && $kintVar->name !== '' ) { $output .= "" . $kintVar->name . " "; } if ( $kintVar->operator !== null ) { $output .= $kintVar->operator . " "; } } if ( $kintVar->type !== null ) { $output .= "" . $kintVar->type; if ( $kintVar->subtype !== null ) { $output .= " " . $kintVar->subtype; } $output .= " "; } if ( $kintVar->size !== null ) { $output .= "(" . $kintVar->size . ") "; } return $output; } /** * produces css and js required for display. May be called multiple times, will only produce output once per * pageload or until `-` or `@` modifier is used * * @return string */ protected static function _css() { if ( !self::$_firstRun ) return ''; self::$_firstRun = false; $baseDir = KINT_DIR . 'view/inc/'; if ( !is_readable( $cssFile = $baseDir . self::$theme . '.css' ) ) { $cssFile = $baseDir . 'original.css'; } return '' . '\n"; } /** * called for each dump, opens the html tag * * @param array $callee caller information taken from debug backtrace * * @return string */ protected static function _wrapStart( $callee ) { // colors looping outputs the same (i.e. if same line in code dumps variables multiple time, // we assume it's in a loop) $uid = isset( $callee['file'] ) ? crc32( $callee['file'] . $callee['line'] ) : 'no-file'; if ( isset( self::$_usedColors[$uid] ) ) { $class = self::$_usedColors[$uid]; } else { $class = sizeof( self::$_usedColors ); self::$_usedColors[$uid] = $class; } $class = "kint_{$class}"; return "
"; } /** * closes Kint::_wrapStart() started html tags and displays callee information * * @param array $callee caller information taken from debug backtrace * @param array $prevCaller previous caller information taken from debug backtrace * * @return string */ protected static function _wrapEnd( $callee, $prevCaller ) { if ( !Kint::$displayCalledFrom ) { return '
'; } $callingFunction = ''; if ( isset( $prevCaller['class'] ) ) { $callingFunction = $prevCaller['class']; } if ( isset( $prevCaller['type'] ) ) { $callingFunction .= $prevCaller['type']; } if ( isset( $prevCaller['function'] ) && !in_array( $prevCaller['function'], Kint::$_statements ) ) { $callingFunction .= $prevCaller['function'] . '()'; } $callingFunction and $callingFunction = " in ({$callingFunction})"; $calleeInfo = isset( $callee['file'] ) ? 'Called from ' . self::shortenPath( $callee['file'], $callee['line'] ) : ''; return $calleeInfo || $callingFunction ? "" : ""; } }