order_id = $order_id; try { $this->occurred_at = ! empty( $occurred_at ) ? new \DateTimeImmutable( $occurred_at, wp_timezone() ) : new \DateTimeImmutable( 'now', wp_timezone() ); } catch ( \Exception $exception ) { $this->occurred_at = new \DateTimeImmutable( 'now', wp_timezone() ); } } /** * {@inheritdoc} */ public function getName(): string { return self::NAME; } public static function getLabel(): string { return __( 'Order Created', 'afroit-messaging-workflows' ); } /** * {@inheritdoc} */ public function getPayload(): array { return array( 'order_id' => $this->order_id, ); } /** * {@inheritdoc} */ public function getOccurredAt(): \DateTimeImmutable { return $this->occurred_at; } /** * Get order ID. * * @return int */ public function getOrderId(): int { return $this->order_id; } }