PhpMimeMailParser\Parser::decodeSingleHeader PHP Метод

decodeSingleHeader() защищенный Метод

Decodes a single header (= string)
protected decodeSingleHeader ( string $input ) : string
$input string
Результат string
    protected function decodeSingleHeader($input)
    {
        // For each encoded-word...
        while (preg_match('/(=\\?([^?]+)\\?(q|b)\\?([^?]*)\\?=)((\\s+)=\\?)?/i', $input, $matches)) {
            $encoded = $matches[1];
            $charset = $matches[2];
            $encoding = $matches[3];
            $text = $matches[4];
            $space = isset($matches[6]) ? $matches[6] : '';
            switch (strtolower($encoding)) {
                case 'b':
                    $text = $this->decodeContentTransfer($text, 'base64');
                    break;
                case 'q':
                    $text = str_replace('_', ' ', $text);
                    preg_match_all('/=([a-f0-9]{2})/i', $text, $matches);
                    foreach ($matches[1] as $value) {
                        $text = str_replace('=' . $value, chr(hexdec($value)), $text);
                    }
                    break;
            }
            $text = $this->charset->decodeCharset($text, $this->charset->getCharsetAlias($charset));
            $input = str_replace($encoded . $space, $text, $input);
        }
        return $input;
    }