*/ public function get_countries(): array { return [ 'australian' => 'Australia', 'austrian' => 'Austria', 'brazilian' => 'Brazil', 'canadian' => 'Canada', 'china' => 'China', 'christian' => 'Christian Holidays', 'croatian' => 'Croatia', 'czech' => 'Czech Republic', 'danish' => 'Denmark', 'dutch' => 'Netherlands', 'finnish' => 'Finland', 'french' => 'France', 'german' => 'Germany', 'greek' => 'Greece', 'hong_kong' => 'Hong Kong', 'hungarian' => 'Hungary', 'indian' => 'India', 'indonesian' => 'Indonesia', 'iranian' => 'Iran', 'irish' => 'Ireland', 'islamic' => 'Islamic Holidays', 'italian' => 'Italy', 'japanese' => 'Japan', 'jewish' => 'Jewish Holidays', 'malaysia' => 'Malaysia', 'mexican' => 'Mexico', 'new_zealand' => 'New Zealand', 'norwegian' => 'Norway', 'philippines' => 'Philippines', 'polish' => 'Poland', 'portuguese' => 'Portugal', 'romanian' => 'Romania', 'russian' => 'Russia', 'sa' => 'South Africa', 'singapore' => 'Singapore', 'south_korea' => 'South Korea', 'spanish' => 'Spain', 'swedish' => 'Sweden', 'taiwan' => 'Taiwan', 'thai' => 'Thailand', 'turkish' => 'Turkey', 'uk' => 'United Kingdom', 'usa' => 'United States', 'vietnamese' => 'Vietnam', ]; } public function fetch_holidays( string $country_code, int $year ): string { $url = sprintf( self::URL_TEMPLATE, rawurlencode( $country_code ) ); $response = wp_remote_get( $url, [ 'timeout' => 15, ] ); if ( is_wp_error( $response ) ) { throw new \RuntimeException( esc_html( $response->get_error_message() ) ); } $code = wp_remote_retrieve_response_code( $response ); if ( 200 !== $code ) { throw new \RuntimeException( // translators: 1: HTTP status code, 2: country code. sprintf( esc_html__( 'Google Calendar returned HTTP %1$d for %2$s', 'agenticdaisy-calendar' ), (int) $code, esc_html( $country_code ) ) ); } $body = wp_remote_retrieve_body( $response ); if ( empty( $body ) ) { throw new \RuntimeException( esc_html__( 'Empty response from Google Calendar', 'agenticdaisy-calendar' ) ); } return $body; } }