Automattic\WooCommerce\Internal\CLI\Migrator\Core

ProductsController::manage_session_lifecycleprivateWC 1.0

Manage the session lifecycle - create new or resume existing.

Method of the class: ProductsController{}

No Hooks.

Returns

ImportSession|null. Import session instance or null on error.

Usage

// private - for code of main (parent) class only
$result = $this->manage_session_lifecycle( $parsed_args ): ?ImportSession;
$parsed_args(array) (required)
Parsed command arguments.

ProductsController::manage_session_lifecycle() code WC 10.7.0

private function manage_session_lifecycle( array $parsed_args ): ?ImportSession {
	$active_session = ImportSession::get_active();

	if ( $active_session && ! $active_session->is_finished() ) {
		return $this->handle_existing_session( $active_session, $parsed_args );
	}

	return $this->create_new_session( $parsed_args );
}