Automator_Registration::integration( null $integration_code = null, null $integration = null )

Add a new integration


Parameters Parameters

$integration_code

(null) (Optional)

Default value: null

$integration

(null) (Optional)

Default value: null


Top ↑

Return Return

(null)


Source Source

File: src/core/lib/utilities/class-automator-registration.php

	public function integration( $integration_code = null, $integration = null ) {

		if ( null === $integration_code || ! is_string( $integration_code ) ) {
			throw new Automator_Exception( 'You are trying to register an integration without passing an integration code.', 1002 );
		}

		if ( null === $integration || ! is_array( $integration ) ) {
			throw new Automator_Exception( 'You are trying to register an integration without passing an integration object.', 1002 );
		}

		// Register integration if it doesn't already exist
		if ( ! key_exists( $integration_code, Automator()->get_integrations() ) ) {
			Automator()->set_integrations( $integration_code, $integration );
		}

		// Order integrations alphabetically
		Automator()->utilities->sort_integrations_alphabetically();

		return true;
	}