Skip to main content

TierGateEvaluator

\Benecaster\Shortcodes\TierGateEvaluator

Class Premium

The two decisions behind [benecaster_tier_gate], shared by the website (TierGateShortcode, evaluated per visitor) and the RSS feed (FeedTierGate, evaluated per compiled tier). One definition of “at or above” is deliberate — a gate that ranked differently on the episode page and in the feed would show a subscriber text in their podcast app that the website withholds, or the reverse.

Constructor Dependencies

Type Description
MembershipTierRepository
TierMapRepository

Methods

Method Visibility Since Description
meets_minimum( int $show_id, string $tier, string $min_tier ): bool Public Compares positions in the show's tier list (stored order, then creation id) — never raw tier_order values, since every admin-created built-in tier stores 0. Uses MembershipTierRepository::ranked_slugs() when both slugs are native built-in tiers, otherwise TierMapRepository::find_by_show(); the two tables are never mixed. Returns false for an empty slug, the follower slug, or a slug found in neither table.
static split_branches( string $content ): array{0:string,1:string} Public Splits raw content on the first [benecaster_else] (or [benecaster_else /]) into [ gated, else ], trimming wpautop fragments at each branch's edges. No marker present means the else branch is ''.