_loadAdapter($extension); } /** * Redirect all public method calls to the wrapped extension object. * * @param string $methodName * @param array $args * @throws Zend_Crypt_Math_BigInteger_Exception */ public function __call($methodName, $args) { if(!method_exists($this->_math, $methodName)) { require_once 'Zend/Crypt/Math/BigInteger/Exception.php'; throw new Zend_Crypt_Math_BigInteger_Exception('invalid method call: ' . get_class($this->_math) . '::' . $methodName . '() does not exist'); } return call_user_func_array(array($this->_math, $methodName), $args); } /** * @param string $extension * @throws Zend_Crypt_Math_BigInteger_Exception */ protected function _loadAdapter($extension = null) { if ($extension === null) { if (extension_loaded('gmp')) { $extension = 'gmp'; //} elseif (extension_loaded('big_int')) { // $extension = 'big_int'; } else { $extension = 'bcmath'; } } if($extension == 'gmp' && extension_loaded('gmp')) { require_once 'Zend/Crypt/Math/BigInteger/Gmp.php'; $this->_math = new Zend_Crypt_Math_BigInteger_Gmp(); //} elseif($extension == 'bigint' && extension_loaded('big_int')) { // require_once 'Zend/Crypt_Math/BigInteger/Bigint.php'; // $this->_math = new Zend_Crypt_Math_BigInteger_Bigint(); } elseif ($extension == 'bcmath') { require_once 'Zend/Crypt/Math/BigInteger/Bcmath.php'; $this->_math = new Zend_Crypt_Math_BigInteger_Bcmath(); } else { require_once 'Zend/Crypt/Math/BigInteger/Exception.php'; throw new Zend_Crypt_Math_BigInteger_Exception($extension . ' big integer precision math support not detected'); } } }