8 use InvalidArgumentException;
27 return preg_replace_callback(
30 return strtoupper($match[1]);
44 $explodedStr = explode(
'_', $str);
47 if (count($explodedStr) > 1) {
48 foreach ($explodedStr as $value) {
49 $lowercasedStr[] = strtolower($value);
51 $str = implode(
'_', $lowercasedStr);
66 foreach (array_reverse(str_split($number)) as $i => $c) {
67 $str .= $i % 2 ? $c * 2 : $c;
70 return array_sum(str_split($str)) % 10 === 0;
82 public static function initialize($target, array $parameters =
null)
85 foreach ($parameters as $key => $value) {
86 $method =
'set'.ucfirst(static::camelCase($key));
87 if (method_exists($target, $method)) {
88 $target->$method($value);
102 if (0 === strpos($className,
'\\')) {
103 $className = substr($className, 1);
106 if (0 === strpos($className,
'Omnipay\\')) {
107 return trim(str_replace(
'\\',
'_', substr($className, 8, -7)),
'_');
110 return '\\'.$className;
130 if (0 === strpos($shortName,
'\\')) {
135 $shortName = str_replace(
'_',
'\\', $shortName);
136 if (
false === strpos($shortName,
'\\')) {
140 return '\\Omnipay\\'.$shortName.
'Gateway';