*/ class CommentSubject implements Subject { const KEY = 'wordpress:comment'; /** @var WordPress */ private $wp; /** @var CommentFieldsFactory */ private $commentFieldsFactory; public function __construct( WordPress $wp, CommentFieldsFactory $commentFieldsFactory ) { $this->wp = $wp; $this->commentFieldsFactory = $commentFieldsFactory; } public function getKey(): string { return self::KEY; } public function getName(): string { // translators: automation subject (entity entering automation) title return __('Comment', 'mailpoet'); } public function getArgsSchema(): ObjectSchema { return Builder::object([ 'comment_id' => Builder::integer()->required(), ]); } public function getFields(): array { return $this->commentFieldsFactory->getFields(); } public function getPayload(SubjectData $subjectData): Payload { $commentId = (int)$subjectData->getArgs()['comment_id']; return new CommentPayload($commentId, $this->wp); } }