Bitpay\Math\Math::setEngine PHP Method

setEngine() public static method

public static setEngine ( $engine )
    public static function setEngine($engine)
    {
        static::$engine = $engine;
    }

Usage Example

Esempio n. 1
0
 public function testGenerate()
 {
     if (extension_loaded('gmp')) {
         \Bitpay\Math\Math::setEngine(new \Bitpay\Math\GmpEngine());
     } elseif (extension_loaded('bcmath')) {
         \Bitpay\Math\Math::setEngine(new \Bitpay\Math\BcEngine());
     } else {
         \Bitpay\Math\Math::setEngine(new \Bitpay\Math\RpEngine());
     }
     $priKey = new PrivateKey();
     $this->assertNotNull($priKey);
     $this->assertNull($priKey->getHex());
     $this->assertNull($priKey->getDec());
     $priKey->generate();
     $this->assertEquals(64, strlen($priKey->getHex()));
     $this->assertGreaterThanOrEqual(72, strlen($priKey->getDec()));
 }