src/Modules/Recommendation.php
private function call_theme_api( $slug ) {
		$theme = get_transient( 'ti_theme_info_' . $slug );

		if ( false !== $theme ) {
			return $theme;
		}

		$products = wp_remote_get(
			'https://api.wordpress.org/themes/info/1.1/?action=query_themes&request[theme]=' . $slug . '&request[per_page]=1'
		);
		$products = json_decode( wp_remote_retrieve_body( $products ) );
		if ( is_object( $products ) ) {
			$theme = $products->themes[0];
			set_transient( 'ti_theme_info_' . $slug, $theme, 6 * HOUR_IN_SECONDS );
		}

		return $theme;
	}
private function call_theme_api( $slug ) {
		$theme = get_transient( 'ti_theme_info_' . $slug );

		if ( false !== $theme ) {
			return $theme;
		}

		$products = wp_remote_get(
			'https://api.wordpress.org/themes/info/1.1/?action=query_themes&request[theme]=' . $slug . '&request[per_page]=1'
		);
		$products = json_decode( wp_remote_retrieve_body( $products ) );
		if ( is_object( $products ) ) {
			$theme = $products->themes[0];
			set_transient( 'ti_theme_info_' . $slug, $theme, 6 * HOUR_IN_SECONDS );
		}

		return $theme;
	}
private function call_theme_api ( $ slug ) { $ theme = get_transient ( 'ti_theme_info_' . $ slug ) ; if ( false !== $ theme ) { return $ theme ; } $ products = wp_remote_get ( 'https://api.wordpress.org/themes/info/1.1/?action=query_themes&request[theme]=' . $ slug . '&request[per_page]=1' ) ; $ products = json_decode ( wp_remote_retrieve_body ( $ products ) ) ; if ( is_object ( $ products ) ) { $ theme = $ products -> themes [ 0 ] ; set_transient ( 'ti_theme_info_' . $ slug , $ theme , 6 * HOUR_IN_SECONDS ) ; } return $ theme ; }
Call theme api

@param string $slug theme slug.

@return array|mixed|object
Call theme api