Files
piratepoet/mailpoet/lib/Automation/Integrations/WordPress/Payloads/PostPayload.php
David Remer e0b871454b Add PostSubject
[PREMIUM-248]
2023-10-30 21:22:23 +01:00

32 lines
652 B
PHP

<?php declare(strict_types = 1);
namespace MailPoet\Automation\Integrations\WordPress\Payloads;
use MailPoet\Automation\Engine\Integration\Payload;
use MailPoet\Automation\Engine\WordPress;
class PostPayload implements Payload {
/** @var int */
private $postId;
/** @var WordPress */
private $wp;
public function __construct(
int $postId,
WordPress $wp
) {
$this->postId = $postId;
$this->wp = $wp;
}
public function getPostId(): int {
return $this->postId;
}
public function getPost(): ?\WP_Post {
$post = $this->wp->getPost($this->postId);
return $post instanceof \WP_Post ? $post : null;
}
}