Task_Manager::get_task( string $state )

Summary

No summary available.

Parameters

$state

(string) (Required) The current state of the import


Return

(BigCommerceImportTask_Definition)


Source

File: src/BigCommerce/Import/Task_Manager.php

	public function get_task( $state ) {
		ksort( $this->tasks );
		$prior_complete = false;
		if ( empty( $state ) || $state === Status::NOT_STARTED ) {
			$prior_complete = true; // take the first task we find
		}

		foreach ( $this->tasks as $group ) {
			foreach ( $group as $task ) {
				if ( $prior_complete || in_array( $state, $task->get_in_progress_states() ) ) {
					return $task;
				} elseif ( $state === $task->get_completion_state() ) {
					$prior_complete = true;
				}
			}
		}

		throw new No_Task_Found_Exception( sprintf( __( 'No task found to handle state %s', 'bigcommerce' ), $state ) );
	}


User Contributed Notes

You must log in before being able to contribute a note or feedback.