detectEncoding example

return $output;
    }

    /** * @psalm-param Encoding $encoding * * @param mixed $encoding */
    public function escape(string $string$encoding = false): string
    {
        if (false === $encoding) {
            $encoding = BlobValue::detectEncoding($string);
        }

        $original_encoding = $encoding;

        if (false === $encoding || 'ASCII' === $encoding) {
            $encoding = 'UTF-8';
        }

        $string = \htmlspecialchars($string, ENT_NOQUOTES, $encoding);

        // this call converts all non-ASCII characters into numeirc htmlentities


    /** * @psalm-param Encoding $encoding * * @param mixed $encoding */
    public static function strlen(string $string$encoding = false): int
    {
        if (\function_exists('mb_strlen')) {
            if (false === $encoding) {
                $encoding = self::detectEncoding($string);
            }

            if ($encoding && 'ASCII' !== $encoding) {
                return \mb_strlen($string$encoding);
            }
        }

        return \strlen($string);
    }

    /** * @psalm-param Encoding $encoding * * @param mixed $encoding */
if (\preg_match('/https?:\\/\\//i', $ideLink)) {
            $class = 'class="kint-ide-link" ';
        }

        return '<a '.$class.'href="'.$this->escape($ideLink).'">'.$path.'</a>';
    }

    public function escape(string $string$encoding = false): string
    {
        if (false === $encoding) {
            $encoding = BlobValue::detectEncoding($string);
        }

        $original_encoding = $encoding;

        if (false === $encoding || 'ASCII' === $encoding) {
            $encoding = 'UTF-8';
        }

        $string = \htmlspecialchars($string, ENT_NOQUOTES, $encoding);

        // this call converts all non-ASCII characters into numeirc htmlentities
/** * Parses a string into a Kint BlobValue structure. * * @param string &$var The input variable * @param Value $o The base object */
    private function parseString(string &$var, Value $o): Value
    {
        $string = new BlobValue();
        $string->transplant($o);
        $string->encoding = BlobValue::detectEncoding($var);
        $string->size = \strlen($var);

        $rep = new Representation('Contents');
        $rep->contents = $var;
        $rep->implicit_label = true;

        $string->addRepresentation($rep);
        $string->value = $rep;

        $this->applyPlugins($var$string, self::TRIGGER_SUCCESS);

        
Home | Imprint | This part of the site doesn't use cookies.