Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/validator/Constraints/IsbnValidator.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 |
---|---|
37 | 37 |
38 if (null === $value || '' === $value) { | 38 if (null === $value || '' === $value) { |
39 return; | 39 return; |
40 } | 40 } |
41 | 41 |
42 if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { | 42 if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) { |
43 throw new UnexpectedTypeException($value, 'string'); | 43 throw new UnexpectedTypeException($value, 'string'); |
44 } | 44 } |
45 | 45 |
46 $value = (string) $value; | 46 $value = (string) $value; |
47 $canonical = str_replace('-', '', $value); | 47 $canonical = str_replace('-', '', $value); |
143 | 143 |
144 if (!ctype_digit($isbn)) { | 144 if (!ctype_digit($isbn)) { |
145 return Isbn::INVALID_CHARACTERS_ERROR; | 145 return Isbn::INVALID_CHARACTERS_ERROR; |
146 } | 146 } |
147 | 147 |
148 $length = strlen($isbn); | 148 $length = \strlen($isbn); |
149 | 149 |
150 if ($length < 13) { | 150 if ($length < 13) { |
151 return Isbn::TOO_SHORT_ERROR; | 151 return Isbn::TOO_SHORT_ERROR; |
152 } | 152 } |
153 | 153 |