Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
BigInteger.php
Go to the documentation of this file.
1 <?php
45 {
46 
52  protected $_math = null;
53 
62  public function __construct($extension = null)
63  {
64  if ($extension !== null && !in_array($extension, array('bcmath', 'gmp', 'bigint'))) {
65  #require_once('Zend/Crypt/Math/BigInteger/Exception.php');
66  throw new Zend_Crypt_Math_BigInteger_Exception('Invalid extension type; please use one of bcmath, gmp or bigint');
67  }
68  $this->_loadAdapter($extension);
69  }
70 
79  public function __call($methodName, $args)
80  {
81  if(!method_exists($this->_math, $methodName)) {
82  #require_once 'Zend/Crypt/Math/BigInteger/Exception.php';
83  throw new Zend_Crypt_Math_BigInteger_Exception('invalid method call: ' . get_class($this->_math) . '::' . $methodName . '() does not exist');
84  }
85  return call_user_func_array(array($this->_math, $methodName), $args);
86  }
87 
92  protected function _loadAdapter($extension = null)
93  {
94  if ($extension === null) {
95  if (extension_loaded('gmp')) {
96  $extension = 'gmp';
97  //} elseif (extension_loaded('big_int')) {
98  // $extension = 'big_int';
99  } else {
100  $extension = 'bcmath';
101  }
102  }
103  if($extension == 'gmp' && extension_loaded('gmp')) {
104  #require_once 'Zend/Crypt/Math/BigInteger/Gmp.php';
105  $this->_math = new Zend_Crypt_Math_BigInteger_Gmp();
106  //} elseif($extension == 'bigint' && extension_loaded('big_int')) {
107  // #require_once 'Zend/Crypt_Math/BigInteger/Bigint.php';
108  // $this->_math = new Zend_Crypt_Math_BigInteger_Bigint();
109  } elseif ($extension == 'bcmath' && extension_loaded('bcmath')) {
110  #require_once 'Zend/Crypt/Math/BigInteger/Bcmath.php';
111  $this->_math = new Zend_Crypt_Math_BigInteger_Bcmath();
112  } else {
113  #require_once 'Zend/Crypt/Math/BigInteger/Exception.php';
114  throw new Zend_Crypt_Math_BigInteger_Exception($extension . ' big integer precision math support not detected');
115  }
116  }
117 
118 }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
_loadAdapter($extension=null)
Definition: BigInteger.php:92
__call($methodName, $args)
Definition: BigInteger.php:79
__construct($extension=null)
Definition: BigInteger.php:62