Jose\Util\BigInteger::toBytes PHP Method

toBytes() public method

Converts a BigInteger to a binary string.
public toBytes ( ) : string
return string
    public function toBytes()
    {
        if (gmp_cmp($this->value, gmp_init(0)) === 0) {
            return '';
        }
        $temp = gmp_strval(gmp_abs($this->value), 16);
        $temp = mb_strlen($temp, '8bit') & 1 ? '0' . $temp : $temp;
        $temp = hex2bin($temp);
        return ltrim($temp, chr(0));
    }