use Symfony\Component\Notifier\Exception\InvalidArgumentException;
use Symfony\Component\Notifier\Message\MessageOptionsInterface;
/**
* @author Joseph Bielawski <stloyd@gmail.com>
*/
final class PagerDutyOptions implements MessageOptionsInterface
{ public function __construct(string
$routingKey, string
$eventAction, string
$severity,
private array
$options =
[]) { if (!\
in_array($eventAction,
['trigger', 'acknowledge', 'resolve'
], true
)) { throw new InvalidArgumentException('Invalid "event_action" option given.'
);
} if (!\
in_array($severity,
['critical', 'warning', 'error', 'info'
], true
)) { throw new InvalidArgumentException('Invalid "severity" option given.'
);
} if ($this->options
['payload'
]['timestamp'
] ?? null
) { $timestamp = \DateTimeImmutable::
createFromFormat(\DateTimeInterface::RFC3339_EXTENDED,
$this->options
['payload'
]['timestamp'
]);
if (false ===
$timestamp) { throw new InvalidArgumentException('Timestamp date must be in "RFC3339_EXTENDED" format.'
);
} }