Skip to content

Commit

Permalink
Fix datetime options to allow provide \DateTimeInterface instances
Browse files Browse the repository at this point in the history
  • Loading branch information
norkunas committed Feb 18, 2018
1 parent 570dda2 commit 696da61
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Resolver/NotificationResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,15 @@ public function resolve(array $data)
})
->setDefined('send_after')
->setAllowedTypes('send_after', '\DateTimeInterface')
->setNormalizer('send_after', function (Options $options, \DateTime $value) {
->setNormalizer('send_after', function (Options $options, \DateTimeInterface $value) {
return $this->normalizeDateTime($options, $value, self::SEND_AFTER_FORMAT);
})
->setDefined('delayed_option')
->setAllowedTypes('delayed_option', 'string')
->setAllowedValues('delayed_option', ['timezone', 'last-active'])
->setDefined('delivery_time_of_day')
->setAllowedTypes('delivery_time_of_day', '\DateTimeInterface')
->setNormalizer('delivery_time_of_day', function (Options $options, \DateTime $value) {
->setNormalizer('delivery_time_of_day', function (Options $options, \DateTimeInterface $value) {
return $this->normalizeDateTime($options, $value, self::DELIVERY_TIME_OF_DAY_FORMAT);
})
->setDefined('android_led_color')
Expand Down Expand Up @@ -278,7 +278,7 @@ private function filterWebButtons($buttons)
return true;
}

private function normalizeDateTime(Options $options, \DateTime $value, $format)
private function normalizeDateTime(Options $options, \DateTimeInterface $value, $format)
{
return $value->format($format);
}
Expand Down

0 comments on commit 696da61

Please sign in to comment.