API / Minn\Runtime / CommentCloser

CommentCloser final readonly class

Minn\Runtime\CommentCloser · public/minn/src/Minn/Runtime/CommentCloser.php · 30 lines

The Discussion setting that closes comments on old posts. Observed on the reference: only the "post" type closes (the types filter changes nothing), status is not consulted, the age is whole days on post_date_gmt and must exceed the setting (a fifteen-day-old post stays open at fifteen), and zero days switches the rule off.

Constants and properties

privatereadonly bool $enabled

Promoted from the constructor.

privatereadonly int $days

Promoted from the constructor.

Public

new__construct(bool $enabled, int $days)#
methodopen(bool $open, Minn\Content\PostRecord|array|null $post, int $now): bool#

Whether comments stay open on a post under the close-after-days setting.

methodcloses(string $postType, string $postDateGmt, array $types, int $now): bool#

Whether the setting closes a post of $postType published at $postDateGmt: the type is one of $types, the setting is on, and the post is older than the days allowed. The posts a single query hands over (_close_comments_for_old_posts) take their types from the close_comments_for_post_types filter, which is honoured there.

$typeslist<string>