芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/reginaeigbe.com/folder/admin/tmp/vendor/omnipay/common/src/Common/Helper.php
1) { foreach ($explodedStr as $value) { $lowercasedStr[] = strtolower($value); } $str = implode('_', $lowercasedStr); } return $str; } /** * Validate a card number according to the Luhn algorithm. * * @param string $number The card number to validate * @return boolean True if the supplied card number is valid */ public static function validateLuhn($number) { $str = ''; foreach (array_reverse(str_split($number)) as $i => $c) { $str .= $i % 2 ? $c * 2 : $c; } return array_sum(str_split($str)) % 10 === 0; } /** * Initialize an object with a given array of parameters * * Parameters are automatically converted to camelCase. Any parameters which do * not match a setter on the target object are ignored. * * @param mixed $target The object to set parameters on * @param array $parameters An array of parameters to set */ public static function initialize($target, array $parameters = null) { if ($parameters) { foreach ($parameters as $key => $value) { $method = 'set'.ucfirst(static::camelCase($key)); if (method_exists($target, $method)) { $target->$method($value); } } } } /** * Resolve a gateway class to a short name. * * The short name can be used with GatewayFactory as an alias of the gateway class, * to create new instances of a gateway. */ public static function getGatewayShortName($className) { if (0 === strpos($className, '\\')) { $className = substr($className, 1); } if (0 === strpos($className, 'Omnipay\\')) { return trim(str_replace('\\', '_', substr($className, 8, -7)), '_'); } return '\\'.$className; } /** * Resolve a short gateway name to a full namespaced gateway class. * * Class names beginning with a namespace marker (\) are left intact. * Non-namespaced classes are expected to be in the \Omnipay namespace, e.g.: * * \Custom\Gateway => \Custom\Gateway * \Custom_Gateway => \Custom_Gateway * Stripe => \Omnipay\Stripe\Gateway * PayPal\Express => \Omnipay\PayPal\ExpressGateway * PayPal_Express => \Omnipay\PayPal\ExpressGateway * * @param string $shortName The short gateway name or the FQCN * @return string The fully namespaced gateway class name */ public static function getGatewayClassName($shortName) { // If the class starts with \ or Omnipay\, assume it's a FQCN if (0 === strpos($shortName, '\\') || 0 === strpos($shortName, 'Omnipay\\')) { return $shortName; } // Check if the class exists and implements the Gateway Interface, if so -> FCQN if (is_subclass_of($shortName, GatewayInterface::class, true)) { return $shortName; } // replace underscores with namespace marker, PSR-0 style $shortName = str_replace('_', '\\', $shortName); if (false === strpos($shortName, '\\')) { $shortName .= '\\'; } return '\\Omnipay\\'.$shortName.'Gateway'; } }