public static function hasFlag(string $flag) : bool
    {
        // Standardize the flag name - remove starting hyphens.
        $flag = ltrim($flag, '-');

        // Return the check right away if it's already cached.
        if (isset(static::$flags[$flag])) {
            return static::$flags[$flag];
        }

        // Grab the output of phpinfo(). If INFO_ALL is already available, we will just parse it instead of
        // fetching INFO_GENERAL specifically for our case. Then we are simply going to check if the --string
        // appears in the info.
        $result = strpos(static::$info[INFO_ALL] ?? static::getInfo(INFO_GENERAL), '--'.$flag);

        // Cache the result and return it.
        return static::$flags[$flag] = false !== $result;
    }