Laravel version update

Laravel version update
This commit is contained in:
Manish Verma
2018-08-06 18:48:58 +05:30
parent d143048413
commit 126fbb0255
13678 changed files with 1031482 additions and 778530 deletions

View File

@@ -31,6 +31,7 @@ class CreditCard extends AbstractValidator
const MASTERCARD = 'Mastercard';
const SOLO = 'Solo';
const VISA = 'Visa';
const MIR = 'Mir';
const CHECKSUM = 'creditcardChecksum';
const CONTENT = 'creditcardContent';
@@ -72,6 +73,7 @@ class CreditCard extends AbstractValidator
8 => self::SOLO,
9 => self::UNIONPAY,
10 => self::VISA,
11 => self::MIR,
];
/**
@@ -83,14 +85,15 @@ class CreditCard extends AbstractValidator
self::AMERICAN_EXPRESS => [15],
self::DINERS_CLUB => [14],
self::DINERS_CLUB_US => [16],
self::DISCOVER => [16],
self::DISCOVER => [16, 19],
self::JCB => [15, 16],
self::LASER => [16, 17, 18, 19],
self::MAESTRO => [12, 13, 14, 15, 16, 17, 18, 19],
self::MASTERCARD => [16],
self::SOLO => [16, 18, 19],
self::UNIONPAY => [16, 17, 18, 19],
self::VISA => [16],
self::VISA => [13, 16, 19],
self::MIR => [13, 16],
];
/**
@@ -112,13 +115,17 @@ class CreditCard extends AbstractValidator
self::LASER => ['6304', '6706', '6771', '6709'],
self::MAESTRO => ['5018', '5020', '5038', '6304', '6759', '6761', '6762', '6763',
'6764', '6765', '6766', '6772'],
self::MASTERCARD => ['51', '52', '53', '54', '55'],
self::MASTERCARD => ['2221', '2222', '2223', '2224', '2225', '2226', '2227', '2228', '2229',
'223', '224', '225', '226', '227', '228', '229',
'23', '24', '25', '26', '271', '2720',
'51', '52', '53', '54', '55'],
self::SOLO => ['6334', '6767'],
self::UNIONPAY => ['622126', '622127', '622128', '622129', '62213', '62214',
'62215', '62216', '62217', '62218', '62219', '6222', '6223',
'6224', '6225', '6226', '6227', '6228', '62290', '62291',
'622920', '622921', '622922', '622923', '622924', '622925'],
self::VISA => ['4'],
self::MIR => ['2200', '2201', '2202', '2203', '2204'],
];
/**
@@ -140,17 +147,17 @@ class CreditCard extends AbstractValidator
{
if ($options instanceof Traversable) {
$options = ArrayUtils::iteratorToArray($options);
} elseif (!is_array($options)) {
} elseif (! is_array($options)) {
$options = func_get_args();
$temp['type'] = array_shift($options);
if (!empty($options)) {
if (! empty($options)) {
$temp['service'] = array_shift($options);
}
$options = $temp;
}
if (!array_key_exists('type', $options)) {
if (! array_key_exists('type', $options)) {
$options['type'] = self::ALL;
}
@@ -200,13 +207,20 @@ class CreditCard extends AbstractValidator
}
foreach ($type as $typ) {
if (defined('self::' . strtoupper($typ)) && !in_array($typ, $this->options['type'])) {
$this->options['type'][] = $typ;
}
if (($typ == self::ALL)) {
$this->options['type'] = array_keys($this->cardLength);
continue;
}
if (in_array($typ, $this->options['type'])) {
continue;
}
$constant = 'static::' . strtoupper($typ);
if (! defined($constant) || in_array(constant($constant), $this->options['type'])) {
continue;
}
$this->options['type'][] = constant($constant);
}
return $this;
@@ -231,7 +245,7 @@ class CreditCard extends AbstractValidator
*/
public function setService($service)
{
if (!is_callable($service)) {
if (! is_callable($service)) {
throw new Exception\InvalidArgumentException('Invalid callback given');
}
@@ -249,12 +263,12 @@ class CreditCard extends AbstractValidator
{
$this->setValue($value);
if (!is_string($value)) {
if (! is_string($value)) {
$this->error(self::INVALID, $value);
return false;
}
if (!ctype_digit($value)) {
if (! ctype_digit($value)) {
$this->error(self::CONTENT, $value);
return false;
}
@@ -300,11 +314,11 @@ class CreditCard extends AbstractValidator
}
$service = $this->getService();
if (!empty($service)) {
if (! empty($service)) {
try {
$callback = new Callback($service);
$callback->setOptions($this->getType());
if (!$callback->isValid($value)) {
if (! $callback->isValid($value)) {
$this->error(self::SERVICE, $value);
return false;
}