public function __construct()

in app/classes/ReleaseInsights/Beta.php [27:47]


    public function __construct(public int $release = BETA) {
        $this->count = (int) explode('b', FIREFOX_BETA)[1];

        // We get the number of betas from the planned schedule
        $schedule = new Release((string) $release)->getSchedule();
        $schedule = array_keys($schedule);
        $schedule = array_filter($schedule, fn($label) => str_starts_with($label, 'beta_'));
        $this->number_betas = count($schedule);

        // Check if the beta cycle is over, this avoids a miscount for RC builds
        if ($this->count >= $this->number_betas && ! defined('TESTING_CONTEXT')) {
            // @codeCoverageIgnoreStart
            // TODO: cache this request as it can take multiple seconds when hg is slow
            $this->beta_cycle_ended = str_contains((string) get_headers(
                URL::Mercurial->value . 'releases/mozilla-beta/json-pushes?fromchange=' . 'FIREFOX_BETA_' . BETA . '_END')[0],
                '200');
            // @codeCoverageIgnoreEnd
        } else {
            $this->beta_cycle_ended = false;
        }
    }