FOF30\Encrypt\Base32::bin2str PHP Метод

bin2str() приватный Метод

Converts a binary string to an ascii string
private bin2str ( string $str ) : string
$str string The string of 0's and 1's you want to convert
Результат string The ascii output
    private function bin2str($str)
    {
        if (strlen($str) % 8 > 0) {
            throw new \InvalidArgumentException('Length must be divisible by 8');
        }
        if (!preg_match('/^[01]+$/', $str)) {
            throw new \InvalidArgumentException('Only 0\'s and 1\'s are permitted');
        }
        preg_match_all('/.{8}/', $str, $chrs);
        $chrs = array_map('bindec', $chrs[0]);
        // I'm just being slack here
        array_unshift($chrs, 'C*');
        return call_user_func_array('pack', $chrs);
    }