Files
piratepoet/mailpoet/lib/Automation/Integrations/WordPress/Payloads/CommentPayload.php
David Remer 17f3fcb368 Make variable protected
[PREMIUM-249]
2023-10-31 10:20:17 +01:00

32 lines
699 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 CommentPayload implements Payload {
/** @var int */
private $commentId;
/** @var WordPress */
protected $wp;
public function __construct(
int $commentId,
WordPress $wp
) {
$this->commentId = $commentId;
$this->wp = $wp;
}
public function getCommentId(): int {
return $this->commentId;
}
public function getComment(): ?\WP_Comment {
$comment = $this->wp->getComment($this->commentId);
return $comment instanceof \WP_Comment ? $comment : null;
}
}