Encode bundle to a string of contiguous PEM blocks.

@return string
434786
public function string(): string
    {
        return implode("\n",
            array_map(
                function (PEM $pem) {
                    return $pem->string();
                }, $this->_pems));
    }
385604
def pem2der(pem_string):
    """"""
    # Encode all lines between the first '-----\n' and the 2nd-to-last '-----'.
    pem_string = pem_string.replace(b"\r", b"")
    first_idx = pem_string.find(b"-----\n") + 6
    if pem_string.find(b"-----BEGIN", first_idx) != -1:
        raise Exception("pem2der() expects only one PEM-encoded object")
    last_idx = pem_string.rfind(b"-----", 0, pem_string.rfind(b"-----"))
    base64_string = pem_string[first_idx:last_idx]
    base64_string.replace(b"\n", b"")
    der_string = base64.b64decode(base64_string)
    return der_string
966414
public function encode()
    {
    	foreach ($this->body as $key => $value) {
    		$result[] = $this->replaceText($value);
    	}

    	return implode('', $result);
    }
494028
public function getRawContent()
    {
        if ($this->size == 0) {
            return '';
        }

        if ($this->encoding === 'base64') {
            $raw = base64_decode($this->content, true);
            if ($raw === false) {
                throw new \RuntimeException('Failed to decode content');
            }

            return $raw;
        }

        throw new \RuntimeException('Unrecognised blob encoding: ' . $this->encoding);
    }
191663
public function serialize(): string {
        $data['check']          = $this->check;
        $data['base']           = $this->base;
        $data['index']          = $this->index;
        $data['fail_states']    = $this->fail_states;
        $data['index_count']    = $this->index_count;
        $data['index_code']     = $this->index_code;
        $data['tmp_tree']       = $this->tmp_tree;
        $data['word_states']    = $this->word_states;
        $data['begin_used']     = $this->begin_used;
        return msgpack_pack($data);
    }
1212933
public function encodeModeStructure()
    {
        try {
            $bs =  new QRbitstream();

            $bs->appendNum(4, 0x03);
            $bs->appendNum(4, ord($this->data[1]) - 1);
            $bs->appendNum(4, ord($this->data[0]) - 1);
            $bs->appendNum(8, ord($this->data[2]));

            $this->bstream = $bs;
            return 0;

        } catch (Exception $e) {
            return -1;
        }
    }
1119181
public function getEncodings()
    {
        if (null !== $this->encodings) {
            return $this->encodings;
        }

        return $this->encodings = array_keys(AcceptHeader::fromString($this->headers->get('Accept-Encoding'))->all());
    }
668168
public function toString() {
		$docblock = "/**\n";
		
		// short description
		$short = trim($this->shortDescription);
		if (!empty($short)) {
			$docblock .= $this->writeLines(explode("\n", $short));
		}
		
		// short description
		$long = trim($this->longDescription);
		if (!empty($long)) {
			$docblock .= $this->writeLines(explode("\n", $long), !empty($short));
		}
		
		// tags
		$tags = $this->getSortedTags()->map(function($tag) {
			return $tag->toString();
		});
		
		if (!$tags->isEmpty()) {
			$docblock .= $this->writeLines($tags->toArray(), !empty($short) || !empty($long));
		}

		$docblock .= ' */';
		
		return $docblock;
	}
881935
public function toString()
    {
        $result = "";
        if ($this->scheme) {
            $result .= $this->scheme.'://';
        }
        if ($this->user) {
            $result .= $this->user;
            if ($this->pass) {
                $result .= $this->user;
            }
            $result .= '@';
        }
        if ($this->host) {
            $result .= $this->host;
        }
        if ($this->port) {
            $result .= ':'.$this->port;
        }
        if ($this->pathSegments) {
            $result .= '/'.implode('/', $this->pathSegments);
        }
        if ($this->parameters) {
            $result .= '?'.http_build_query($this->parameters);
        }
        if ($this->fragment) {
            $result .= '#'.$this->fragment;
        }
        return $result;
    }
70110
protected function getEncodedItems()
    {
        $assetAdmin = AssetAdmin::singleton();
        $fileData = [];
        foreach ($this->getItems() as $file) {
            $fileData[] = $assetAdmin->getMinimalistObjectFromData($file);
        }
        return $fileData;
    }
313124
private function pem2der($pem_data) {
        $begin = "CERTIFICATE-----";
        $end   = "-----END";
        $pem_data = substr($pem_data, strpos($pem_data, $begin) + strlen($begin));
        $pem_data = substr($pem_data, 0, strpos($pem_data, $end));

        return  base64_decode($pem_data);
    }
814262
public function encode($buffer)
    {
        $total_length = $this->package_length_type_length + strlen($buffer) - $this->package_body_offset;
        return pack($this->package_length_type, $total_length) . $buffer;
    }
1005498
void encode() {
        final int bwtLength = this.bwtLength;
        final boolean[] bwtValuesPresent = this.bwtValuesPresent;
        final int[] bwtBlock = this.bwtBlock;
        final char[] mtfBlock = this.mtfBlock;
        final int[] mtfSymbolFrequencies = this.mtfSymbolFrequencies;
        final byte[] huffmanSymbolMap = new byte[256];
        final Bzip2MoveToFrontTable symbolMTF = new Bzip2MoveToFrontTable();

        int totalUniqueValues = 0;
        for (int i = 0; i < huffmanSymbolMap.length; i++) {
            if (bwtValuesPresent[i]) {
                huffmanSymbolMap[i] = (byte) totalUniqueValues++;
            }
        }
        final int endOfBlockSymbol = totalUniqueValues + 1;

        int mtfIndex = 0;
        int repeatCount = 0;
        int totalRunAs = 0;
        int totalRunBs = 0;
        for (int i = 0; i < bwtLength; i++) {
            // Move To Front
            final int mtfPosition = symbolMTF.valueToFront(huffmanSymbolMap[bwtBlock[i] & 0xff]);
            // Run Length Encode
            if (mtfPosition == 0) {
                repeatCount++;
            } else {
                if (repeatCount > 0) {
                    repeatCount--;
                    while (true) {
                        if ((repeatCount & 1) == 0) {
                            mtfBlock[mtfIndex++] = HUFFMAN_SYMBOL_RUNA;
                            totalRunAs++;
                        } else {
                            mtfBlock[mtfIndex++] = HUFFMAN_SYMBOL_RUNB;
                            totalRunBs++;
                        }

                        if (repeatCount <= 1) {
                            break;
                        }
                        repeatCount = (repeatCount - 2) >>> 1;
                    }
                    repeatCount = 0;
                }
                mtfBlock[mtfIndex++] = (char) (mtfPosition + 1);
                mtfSymbolFrequencies[mtfPosition + 1]++;
            }
        }

        if (repeatCount > 0) {
            repeatCount--;
            while (true) {
                if ((repeatCount & 1) == 0) {
                    mtfBlock[mtfIndex++] = HUFFMAN_SYMBOL_RUNA;
                    totalRunAs++;
                } else {
                    mtfBlock[mtfIndex++] = HUFFMAN_SYMBOL_RUNB;
                    totalRunBs++;
                }

                if (repeatCount <= 1) {
                    break;
                }
                repeatCount = (repeatCount - 2) >>> 1;
            }
        }

        mtfBlock[mtfIndex] = (char) endOfBlockSymbol;
        mtfSymbolFrequencies[endOfBlockSymbol]++;
        mtfSymbolFrequencies[HUFFMAN_SYMBOL_RUNA] += totalRunAs;
        mtfSymbolFrequencies[HUFFMAN_SYMBOL_RUNB] += totalRunBs;

        mtfLength = mtfIndex + 1;
        alphabetSize = endOfBlockSymbol + 1;
    }
1250891
public function toString()
    {
        $result = '';
        if ($this->hasHeaders()) {
            $headers = $this->composeHeaderLines();
            $result .= implode("\n", $headers);
        }

        $content = $this->getContent();
        if ($content !== null) {
            $result .= "\n\n" . $content;
        }

        return $result;
    }
350790
protected function encode(): string
    {
        $bitmap = null;
        $lastRow = null;

        for ($y = 0; $y < $this->height; $y++) {
            $bits = null;

            for ($x = 0; $x < $this->width; $x++) {
                $bits .= $this->decoder->getBitAt($x, $y);
            }

            $bytes = str_split($bits, 8);
            $bytes[] = str_pad(array_pop($bytes), 8, '0');

            $row = null;

            foreach ($bytes as $byte) {
                $row .= sprintf('%02X', bindec($byte));
            }

            $bitmap .= $this->compress($row, $lastRow);
            $lastRow = $row;
        }

        return $bitmap;
    }
433444
public function getOrigBody()
    {
        $_headers = $this->message->headers();
        $headers  = array();

        if ($_headers['Content-Transfer-Encoding']
            && stripos($_headers['Content-Type'], 'multipart') === false
        ) {
            $headers[] = 'Content-Transfer-Encoding: ' . $_headers['Content-Transfer-Encoding'];
        }
        $headers[] = 'Content-Type: ' . $_headers['Content-Type'];

        return implode("\r\n", $headers) . "\r\n\r\n" . $this->body;
    }
922554
protected function generatePuml(): string
    {
        $puml = '';

        foreach ([self::XSL_HEADER, self::XSL_TARGETS, self::XSL_CALLS, self::XSL_FOOTER] as $xslFile) {
            $puml .= $this->transformToPuml($xslFile);
        }

        return $puml;
    }