_rc = new \ReflectionClass($this); } public function __call($name, $value) { try { if (($this->_request instanceof Request) and ($this->_request->_rc->hasMethod("_{$name}"))) { return call_user_func_array([$this->_request, "_{$name}"], $value); } switch (strtolower($name)) { case "auth": case "capture": case "purchase": case "refund": case "statuscheck": case "status_check": case "void": case "tokenize": return call_user_func_array([$this->_request, $name], $this->_data); break; case "merchantid": Config::$MerchantId = $value[0]; break; case "password": Config::$Password = $value[0]; break; } if (!isset($value[0])) { if (isset($this->_data[$name])) { return $this->_data[$name]; } else { return null; } } else { if (is_array($value[0])) { foreach ($value[0] as $k => $v) { $this->_data[$k] = $v; } } else { $this->_data[$name] = $value[0]; } } return $this; } catch (Exception $e) { throw $e; } } protected function _set($data = []) { try { if ((is_array($data)) and (count($data) > 0)) { foreach ($data as $name => $value) { if (is_array($value)) { call_user_func_array([$this, "_set"], $value); } else { switch (strtolower($name)) { case "merchantid": Config::$MerchantId = $value; break; case "password": Config::$Password = $value; break; default: $this->_data[$name] = $value; break; } } } } return $this; } catch (Exception $e) { throw $e; } } public function __set($name, $value) { switch (strtolower($name)) { case "merchantid": Config::$MerchantId = $value; break; case "password": Config::$Password = $value; break; default: $this->_data[$name] = $value; break; } } public function __get($name) { return isset($this->_data[$name]) ? $this->_data[$name] : null; } public function __isset($name) { return isset($this->_data[$name]); } public function __unset($name) { unset($this->_data[$name]); } public function offsetSet($offset, $value) { if (is_null($offset)) { $this->_data[] = $value; } else { $this->_data[$offset] = $value; } } public function offsetExists($offset) { return isset($this->_data[$offset]); } public function offsetUnset($offset) { unset($this->_data[$offset]); } public function offsetGet($offset) { return isset($this->_data[$offset]) ? $this->_data[$offset] : null; } function rewind() { return reset($this->_data); } function current() { return current($this->_data); } function key() { return key($this->_data); } function next() { return next($this->_data); } function valid() { return key($this->_data) !== null; } public function serialize() { return serialize($this->_data); } public function unserialize($data) { $this->_data = unserialize($data); } public function __debugInfo() { return $this->_data; } public function testEnvironment() { Config::buildEvoEnv4Test(null, null, null, null); foreach (func_get_args()[0] as $k => $v) { $this->$k = $v; } return $this; } public function productionEnvironment() { Config::buildEvoEnv4Prod(null, null, null, null); foreach (func_get_args()[0] as $k => $v) { $this->$k = $v; } return $this; } public function baseUrl() { return Config::$BaseUrl; } public function javaScriptUrl() { return Config::$JavaScriptUrl; } }