Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/serializer/Normalizer/DateIntervalNormalizer.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 1fec387a4317 |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
37 /** | 37 /** |
38 * {@inheritdoc} | 38 * {@inheritdoc} |
39 * | 39 * |
40 * @throws InvalidArgumentException | 40 * @throws InvalidArgumentException |
41 */ | 41 */ |
42 public function normalize($object, $format = null, array $context = array()) | 42 public function normalize($object, $format = null, array $context = []) |
43 { | 43 { |
44 if (!$object instanceof \DateInterval) { | 44 if (!$object instanceof \DateInterval) { |
45 throw new InvalidArgumentException('The object must be an instance of "\DateInterval".'); | 45 throw new InvalidArgumentException('The object must be an instance of "\DateInterval".'); |
46 } | 46 } |
47 | 47 |
62 * {@inheritdoc} | 62 * {@inheritdoc} |
63 * | 63 * |
64 * @throws InvalidArgumentException | 64 * @throws InvalidArgumentException |
65 * @throws UnexpectedValueException | 65 * @throws UnexpectedValueException |
66 */ | 66 */ |
67 public function denormalize($data, $class, $format = null, array $context = array()) | 67 public function denormalize($data, $class, $format = null, array $context = []) |
68 { | 68 { |
69 if (!is_string($data)) { | 69 if (!\is_string($data)) { |
70 throw new InvalidArgumentException(sprintf('Data expected to be a string, %s given.', gettype($data))); | 70 throw new InvalidArgumentException(sprintf('Data expected to be a string, %s given.', \gettype($data))); |
71 } | 71 } |
72 | 72 |
73 if (!$this->isISO8601($data)) { | 73 if (!$this->isISO8601($data)) { |
74 throw new UnexpectedValueException('Expected a valid ISO 8601 interval string.'); | 74 throw new UnexpectedValueException('Expected a valid ISO 8601 interval string.'); |
75 } | 75 } |