Automattic\WooCommerce\Internal\ProductFeed\Integrations

IntegrationRegistry{}WC 10.5.0

IntegrationRegistry

Хуков нет.

Использование

$IntegrationRegistry = new IntegrationRegistry();
// use class methods

Методы

  1. public get_integration( string $id )
  2. public get_integrations()
  3. public register_integration( IntegrationInterface $integration )
  4. ERROR: no method name found on line ``
  5. ERROR: no method name found on line ``
  6. ERROR: no method name found on line ``
  7. ERROR: no method name found on line ``
  8. ERROR: no method name found on line ``
  9. private array()
  10. ERROR: no method name found on line ``
  11. ERROR: no method name found on line `}`
  12. ERROR: no method name found on line ``

Список изменений

С версии 10.5.0 Введена.

Код IntegrationRegistry{} WC 10.8.1

class IntegrationRegistry {
	/**
	 * List of all available Integrations.
	 *
	 * @var array<string,IntegrationInterface>
	 */
	private array $integrations = array();

	/**
	 * Register an Integration.
	 *
	 * @since 10.5.0
	 *
	 * @param IntegrationInterface $integration The integration to register.
	 */
	public function register_integration( IntegrationInterface $integration ): void {
		$this->integrations[ $integration->get_id() ] = $integration;
	}

	/**
	 * Get an Integration by ID.
	 *
	 * @since 10.5.0
	 *
	 * @param string $id The ID of the Integration.
	 * @return IntegrationInterface|null The Integration, or null if it is not registered.
	 */
	public function get_integration( string $id ): ?IntegrationInterface {
		return $this->integrations[ $id ] ?? null;
	}

	/**
	 * Get all registered integrations.
	 *
	 * @since 10.5.0
	 *
	 * @return array<string,IntegrationInterface>
	 */
	public function get_integrations(): array {
		return $this->integrations;
	}
}