Trigger_Conditions::get_conditions()

Contents


Return Return

(object)


Source Source

File: src/core/lib/recipe-parts/triggers/trait-trigger-conditions.php

	protected function get_conditions() {
		$match_value    = $this->get_find_in();
		$match_value_in = $this->get_find_this();

		// $match_value and $match_value_in counts doesn't match. Throw an exception for developers.
		if ( count( $match_value ) !== count( $match_value_in ) ) {
			throw new Automator_Exception( 'Trigger conditions miss-matched. Please pass values in both $this->do_find_this() and $this->do_find_in().' );
		}

		$match_conditions = new stdClass();
		$count            = count( $match_value );
		$xyz              = 0;
		while ( $xyz < $count ) {
			$match_conditions->$xyz = (object) array(
				'match'    => $match_value[ $xyz ],
				'match_in' => $match_value_in[ $xyz ],
			);
			$xyz ++;
		}

		return $match_conditions;
	}