/** * Test Helpers */ protected function setUp() { parent::setUp(); if (!Number::isBcMathAvailable()) { $this->markTestSkipped('The BcMath extension is not available'); } }
public function testIsBcMathAvailable() { $available = Number::isBcMathAvailable(); if (function_exists('bcadd')) { $this->assertTrue($available); } else { $this->assertFalse($available); } }
/** * Create an instance of an Integer adapter * * @param mixed $number * @static * @access public * @throws AdapterSupportException * @return AdapterInterface */ public static function factory($number) { // Use GMP if we can... its MUCH faster if (Number::isGmpAvailable()) { return Gmp::factory($number); } elseif (Number::isBcMathAvailable()) { return BcMath::factory($number); } // TODO: Fall back to native? throw new AdapterSupportException(); }