Automattic\WooCommerce\Admin\RemoteSpecs

DataSourcePoller::get_specs_from_data_sources()publicWC 1.0

Reads the data sources for specs and persists those specs.

Method of the class: DataSourcePoller{}

Hooks from the method

Return

Array. list of specs.

Usage

$DataSourcePoller = new DataSourcePoller();
$DataSourcePoller->get_specs_from_data_sources();

DataSourcePoller::get_specs_from_data_sources() code WC 9.0.1

public function get_specs_from_data_sources() {
	$locale      = get_user_locale();
	$specs_group = get_transient( $this->args['transient_name'] ) ?? array();
	$specs       = isset( $specs_group[ $locale ] ) ? $specs_group[ $locale ] : array();

	if ( ! is_array( $specs ) || empty( $specs ) ) {
		$this->read_specs_from_data_sources();
		$specs_group = get_transient( $this->args['transient_name'] );
		$specs       = isset( $specs_group[ $locale ] ) ? $specs_group[ $locale ] : array();
	}

	/**
	 * Filter specs.
	 *
	 * @param array      $specs List of specs.
	 * @param string     $this->id Spec identifier.
	 *
	 * @since 8.8.0
	 */
	$specs = apply_filters( self::FILTER_NAME_SPECS, $specs, $this->id );
	return false !== $specs ? $specs : array();
}