Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/validator/Constraints/LuhnValidator.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 4c8ae668cc8c |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
47 return; | 47 return; |
48 } | 48 } |
49 | 49 |
50 // Work with strings only, because long numbers are represented as floats | 50 // Work with strings only, because long numbers are represented as floats |
51 // internally and don't work with strlen() | 51 // internally and don't work with strlen() |
52 if (!is_string($value) && !(is_object($value) && method_exists($value, '__toString'))) { | 52 if (!\is_string($value) && !(\is_object($value) && method_exists($value, '__toString'))) { |
53 throw new UnexpectedTypeException($value, 'string'); | 53 throw new UnexpectedTypeException($value, 'string'); |
54 } | 54 } |
55 | 55 |
56 $value = (string) $value; | 56 $value = (string) $value; |
57 | 57 |
63 | 63 |
64 return; | 64 return; |
65 } | 65 } |
66 | 66 |
67 $checkSum = 0; | 67 $checkSum = 0; |
68 $length = strlen($value); | 68 $length = \strlen($value); |
69 | 69 |
70 // Starting with the last digit and walking left, add every second | 70 // Starting with the last digit and walking left, add every second |
71 // digit to the check sum | 71 // digit to the check sum |
72 // e.g. 7 9 9 2 7 3 9 8 7 1 3 | 72 // e.g. 7 9 9 2 7 3 9 8 7 1 3 |
73 // ^ ^ ^ ^ ^ ^ | 73 // ^ ^ ^ ^ ^ ^ |