is_master_flag_on() ) { return 'economy'; } return $this->resolve_from_category( $idea->get_article_type() ); } // ── Private helpers ────────────────────────────────────────────────── /** * Whether the Authority pipeline master switch is enabled. * * The option defaults to false (disabled). Operators must explicitly * set it to '1' or true via wp_options / WP admin to enable the path. * * @return bool */ private function is_master_flag_on(): bool { $flag = get_option( self::OPTION_MASTER_FLAG, false ); return in_array( $flag, array( '1', true, 1 ), true ); } /** * Resolve tier from the per-category tier map. * * The map is a serialized PHP array (stored via WordPress options) of * `['category_slug' => 'economy']`. Only 'economy' is a meaningful * explicit value — anything else (including 'authority') is treated * as "keep the default". * * Unrecognised or empty maps → default Authority tier (additive safety). * * @param string $article_type Article type / category slug from the idea. * @return string 'authority' or 'economy' */ private function resolve_from_category( string $article_type ): string { $raw = get_option( self::OPTION_CATEGORY_TIERS, array() ); $map = is_array( $raw ) ? $raw : array(); $tier = $map[ $article_type ] ?? self::DEFAULT_TIER; // Only 'economy' is a valid explicit demote; any other value defaults. return 'economy' === $tier ? 'economy' : 'authority'; } }