Server IP : 108.163.255.210 / Your IP : 18.191.26.149 Web Server : Apache System : Linux blossom.urlnameserver.com 3.10.0-1160.80.1.el7.x86_64 #1 SMP Tue Nov 8 15:48:59 UTC 2022 x86_64 User : ( 1172) PHP Version : 7.2.34 Disable Function : eval,escapeshellarg,proc_close,proc_get_status,proc_nice,proc_open,symlink,system,pcntl_exec,getrusage,chown,chgp,closelog,openlog,syslog,define_syslog_variables,php_ini_loaded_file,getservbyname,getservbyport,posix_getgid,posix_getgrgid,proc_terminate,pfsockopen,apache_child_terminate,posix_mkfifo,posix_setpgid,posix_setuid,hypot,pg_host,pos,posix_access,posix_getcwd,posix_getservbyname,myshellexec,getpid,posix_getsid,posix_isatty,posix_kill,posix_mknod,posix_setgid,posix_setsid,posix_setuid,posix_times,posix_uname,ps_fill,posix_getpwuid,global,ini_restore,zip_open,zip_read,rar_open,bzopen,bzread,bzwrite,apache_get_modules,apache_get_version,phpversionphpinfo,php_ini_scanned_files,get_current_user,disk_total_space,diskfreespace,leak,imap_list,hypo,filedump,safe_mode,getmygid,apache_getenv,apache_setenv,bzread,bzwrite,bzopen,phpini,higlight_file,dos_conv,get_cwd,er_log,cmd,e_name,vdir,get_dir,only_read,ftok,ftpexec,posix_getpwnam,mysql_list_dbs,disk_free_space,session_save_path,confirm_phpdoc_compiled,zip_entry_rea,php_u,psockopen,crack_opendict,crack_getlastmessage,crack_closedict,crack_check,fpassthru,posix_get_last_error,posix_getlogin,posix_getgroups,posix_strerror,posix_getrlimit,posix_getpgrp,posix_getgrnam,pos,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/unilinki/public_html/unilinkindia.co.in/app/braintree/Braintree/ |
Upload File : |
<?php namespace Braintree; /** * * CredentialsParser registry * * @package Braintree * @subpackage Utility * @copyright 2015 Braintree, a division of PayPal, Inc. */ class CredentialsParser { private $_clientId; private $_clientSecret; private $_accessToken; private $_environment; private $_merchantId; public function __construct($attribs) { foreach ($attribs as $kind => $value) { if ($kind == 'clientId') { $this->_clientId = $value; } if ($kind == 'clientSecret') { $this->_clientSecret = $value; } if ($kind == 'accessToken') { $this->_accessToken = $value; } } $this->parse(); } /** * * @access protected * @static * @var array valid environments, used for validation */ private static $_validEnvironments = [ 'development', 'integration', 'sandbox', 'production', 'qa', ]; public function parse() { $environments = []; if (!empty($this->_clientId)) { $environments[] = ['clientId', $this->_parseClientCredential('clientId', $this->_clientId, 'client_id')]; } if (!empty($this->_clientSecret)) { $environments[] = ['clientSecret', $this->_parseClientCredential('clientSecret', $this->_clientSecret, 'client_secret')]; } if (!empty($this->_accessToken)) { $environments[] = ['accessToken', $this->_parseAccessToken()]; } $checkEnv = $environments[0]; foreach ($environments as $env) { if ($env[1] !== $checkEnv[1]) { throw new Exception\Configuration( 'Mismatched credential environments: ' . $checkEnv[0] . ' environment is ' . $checkEnv[1] . ' and ' . $env[0] . ' environment is ' . $env[1]); } } self::assertValidEnvironment($checkEnv[1]); $this->_environment = $checkEnv[1]; } public static function assertValidEnvironment($environment) { if (!in_array($environment, self::$_validEnvironments)) { throw new Exception\Configuration('"' . $environment . '" is not a valid environment.'); } } private function _parseClientCredential($credentialType, $value, $expectedValuePrefix) { $explodedCredential = explode('$', $value); if (sizeof($explodedCredential) != 3) { throw new Exception\Configuration('Incorrect ' . $credentialType . ' format. Expected: type$environment$token'); } $gotValuePrefix = $explodedCredential[0]; $environment = $explodedCredential[1]; $token = $explodedCredential[2]; if ($gotValuePrefix != $expectedValuePrefix) { throw new Exception\Configuration('Value passed for ' . $credentialType . ' is not a ' . $credentialType); } return $environment; } private function _parseAccessToken() { $accessTokenExploded = explode('$', $this->_accessToken); if (sizeof($accessTokenExploded) != 4) { throw new Exception\Configuration('Incorrect accessToken syntax. Expected: type$environment$merchant_id$token'); } $gotValuePrefix = $accessTokenExploded[0]; $environment = $accessTokenExploded[1]; $merchantId = $accessTokenExploded[2]; $token = $accessTokenExploded[3]; if ($gotValuePrefix != 'access_token') { throw new Exception\Configuration('Value passed for accessToken is not an accessToken'); } $this->_merchantId = $merchantId; return $environment; } public function getClientId() { return $this->_clientId; } public function getClientSecret() { return $this->_clientSecret; } public function getAccessToken() { return $this->_accessToken; } public function getEnvironment() { return $this->_environment; } public function getMerchantId() { return $this->_merchantId; } } class_alias('Braintree\CredentialsParser', 'Braintree_CredentialsParser');