public static function toString ($v, $enhanced = true)
  {
    if (isset($v)) {
      if ($v instanceof \Closure)
        return '<i>(native code)</i>';
      elseif (is_bool ($v))
        return $v ? '<span class=__type>true</span>' : '<span class=__type>false</span>';
      elseif (is_string ($v)) {
        $l = strlen (self::RAW_TEXT);
        return substr ($v, 0, $l) == self::RAW_TEXT ? substr ($v, $l)
          : sprintf ("<i>'</i>%s<i>'</i>", htmlspecialchars ($v));
      }
      elseif ($v instanceof \PowerString)
        return sprintf ("<i>(</i>%s<i>)'</i>%s<i>'</i>",
          $enhanced ? self::shortenType (\PowerString::class) : typeOf ($v),
          htmlspecialchars ($v));
      elseif (!is_array ($v) && !is_object ($v))
        return htmlspecialchars (str_replace ('    ', '  ', trim (print_r ($v, true))));
    }
    return $enhanced ? sprintf ('<span class=__type>%s</span>', self::getType ($v)) : typeOf ($v);
  }
public static function toString ($v, $enhanced = true)
  {
    if (isset($v)) {
      if ($v instanceof \Closure)
        return '<i>(native code)</i>';
      elseif (is_bool ($v))
        return $v ? '<span class=__type>true</span>' : '<span class=__type>false</span>';
      elseif (is_string ($v)) {
        $l = strlen (self::RAW_TEXT);
        return substr ($v, 0, $l) == self::RAW_TEXT ? substr ($v, $l)
          : sprintf ("<i>'</i>%s<i>'</i>", htmlspecialchars ($v));
      }
      elseif ($v instanceof \PowerString)
        return sprintf ("<i>(</i>%s<i>)'</i>%s<i>'</i>",
          $enhanced ? self::shortenType (\PowerString::class) : typeOf ($v),
          htmlspecialchars ($v));
      elseif (!is_array ($v) && !is_object ($v))
        return htmlspecialchars (str_replace ('    ', '  ', trim (print_r ($v, true))));
    }
    return $enhanced ? sprintf ('<span class=__type>%s</span>', self::getType ($v)) : typeOf ($v);
  }
public static function toString ( $ v , $ enhanced = true ) { if ( isset ( $ v ) ) { if ( $ v instanceof \ Closure ) return '<i>(native code)</i>' ; elseif ( is_bool ( $ v ) ) return $ v ? '<span class=__type>true</span>' : '<span class=__type>false</span>' ; elseif ( is_string ( $ v ) ) { $ l = strlen ( self :: RAW_TEXT ) ; return substr ( $ v , 0 , $ l ) == self :: RAW_TEXT ? substr ( $ v , $ l ) : sprintf ( "<i>'</i>%s<i>'</i>" , htmlspecialchars ( $ v ) ) ; } elseif ( $ v instanceof \ PowerString ) return sprintf ( "<i>(</i>%s<i>)'</i>%s<i>'</i>" , $ enhanced ? self :: shortenType ( \ PowerString :: class ) : typeOf ( $ v ) , htmlspecialchars ( $ v ) ) ; elseif ( ! is_array ( $ v ) && ! is_object ( $ v ) ) return htmlspecialchars ( str_replace ( '    ' , '  ' , trim ( print_r ( $ v , true ) ) ) ) ; } return $ enhanced ? sprintf ( '<span class=__type>%s</span>' , self :: getType ( $ v ) ) : typeOf ( $ v ) ; }
Returns an HTML-formatted textual representation of a given value.

@param mixed $v When it's a string, if it begins with {@see RAW_TEXT}, it is not escaped.
@param bool  $enhanced
@return string
Returns an HTML - formatted textual representation of a given value .