public static function getDesktopAdoptionRate()

in app/classes/ReleaseInsights/Data.php [213:240]


    public static function getDesktopAdoptionRate(string $version): ?float
    {
        // Check current uptake rate for the latest release*
        // @codeCoverageIgnoreStart
        if (! defined('TESTING_CONTEXT')) {
            $uptake = Json::load(URL::Pollbot->value
                    . 'firefox/'
                    . $version
                    . '/telemetry/main-summary-uptake')['message'] ?? '0' ;
        } else {
        // @codeCoverageIgnoreEnd
            if ($version == '130.0') {
                $uptake = Json::load(URL::Pollbot->target() . 'main-summary-uptake.json')['message'] ?? '0' ;
            } else {
                $uptake = 'Query results contained no rows.';
            }
        }

        if ($uptake == 'Query results contained no rows.') {
            return null;
        }

        // This public data is stored as a string, extract only the number
        $uptake = preg_replace('/Telemetry uptake for version.*\(.*\) is /', '', $uptake);
        $uptake = str_replace('%', '', $uptake);

        return  (float) $uptake;
    }